Source Code Cross Referenced for Column.java in  » J2EE » jag » com » finalist » jaggenerator » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » jag » com.finalist.jaggenerator 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*   Copyright (C) 2003 Finalist IT Group
002:         *
003:         *   This file is part of JAG - the Java J2EE Application Generator
004:         *
005:         *   JAG is free software; you can redistribute it and/or modify
006:         *   it under the terms of the GNU General Public License as published by
007:         *   the Free Software Foundation; either version 2 of the License, or
008:         *   (at your option) any later version.
009:         *   JAG is distributed in the hope that it will be useful,
010:         *   but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012:         *   GNU General Public License for more details.
013:         *   You should have received a copy of the GNU General Public License
014:         *   along with JAG; if not, write to the Free Software
015:         *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
016:         */
017:
018:        package com.finalist.jaggenerator;
019:
020:        import org.apache.commons.logging.Log;
021:        import org.apache.commons.logging.LogFactory;
022:
023:        import java.io.Serializable;
024:
025:        /**
026:         *
027:         * @author  hillebrand
028:         */
029:        public class Column implements  Serializable {
030:            static Log log = LogFactory.getLog(Column.class);
031:            /** Holds value of property name. */
032:            private String name;
033:
034:            /** Holds value of property sqlType. */
035:            private String sqlType;
036:
037:            /** Holds value of property precision. */
038:            private int precision;
039:
040:            /** Holds value of property scale. */
041:            private int scale;
042:
043:            /** Holds value of property length. */
044:            private int length;
045:
046:            /** Set to true if columns is primary key column. */
047:            private boolean primaryKey;
048:
049:            /** True if the column may be null. */
050:            private boolean nullable;
051:
052:            /** Creates a new instance of Column */
053:            public Column() {
054:            }
055:
056:            /** Getter for property name.
057:             * @return Value of property name.
058:             *
059:             */
060:            public String getName() {
061:                return this .name;
062:            }
063:
064:            /** Setter for property name.
065:             * @param name New value of property name.
066:             *
067:             */
068:            public void setName(String name) {
069:                this .name = name;
070:            }
071:
072:            /** Setter for property sqlType.
073:             * @param sqlType New value of property sqlType.
074:             *
075:             */
076:            public void setSqlType(String sqlType) {
077:
078:                // Check if a precision and / or scale have been passed.
079:                if (sqlType != null) {
080:                    int index = sqlType.indexOf("(");
081:                    if (index != -1) {
082:                        this .sqlType = sqlType.substring(0, index);
083:                        // Now als set the scale and precision...
084:                        int index2 = sqlType.indexOf(")");
085:                        if (index2 != -1) {
086:                            // There is a scale and / or precsions.
087:                            int index3 = sqlType.indexOf(",");
088:                            if (index3 != -1) {
089:                                // Scale AND precision!
090:                                String scale = sqlType.substring(index + 1,
091:                                        index3).trim();
092:                                String precision = sqlType.substring(
093:                                        index3 + 1, index2).trim();
094:                                int sc = 0;
095:                                int pr = 0;
096:                                try {
097:                                    sc = Integer.parseInt(scale);
098:                                    pr = Integer.parseInt(precision);
099:                                } catch (Exception e) {
100:                                    log
101:                                            .warn("Error while parsing scale or precision for type "
102:                                                    + sqlType);
103:                                }
104:                                setScale(sc);
105:                                setPrecision(pr);
106:                            } else {
107:                                // Only a scale..
108:                                String scale = sqlType.substring(index + 1,
109:                                        index2).trim();
110:                                int sc = 0;
111:                                try {
112:                                    sc = Integer.parseInt(scale);
113:                                } catch (Exception e) {
114:                                    log
115:                                            .warn("Error while parsing scale for type "
116:                                                    + sqlType);
117:                                }
118:                                setScale(sc);
119:
120:                            }
121:                        }
122:                    } else {
123:                        this .sqlType = sqlType;
124:                    }
125:
126:                }
127:            }
128:
129:            /** Getter for property precision.
130:             * @return Value of property precision.
131:             *
132:             */
133:            public int getPrecision() {
134:                return this .precision;
135:            }
136:
137:            /** Setter for property precision.
138:             * @param precision New value of property precision.
139:             *
140:             */
141:            public void setPrecision(int precision) {
142:                this .precision = precision;
143:            }
144:
145:            /** Getter for property scale.
146:             * @return Value of property scale.
147:             *
148:             */
149:            public int getScale() {
150:                return this .scale;
151:            }
152:
153:            /** Setter for property scale.
154:             * @param scale New value of property scale.
155:             *
156:             */
157:            public void setScale(int scale) {
158:                this .scale = scale;
159:            }
160:
161:            /** Getter for property length.
162:             * @return Value of property length.
163:             *
164:             */
165:            public int getLength() {
166:                return this .length;
167:            }
168:
169:            /** Setter for property length.
170:             * @param length New value of property length.
171:             *
172:             */
173:            public void setLength(int length) {
174:                this .length = length;
175:            }
176:
177:            /** Getter for property sqlType.
178:             * @return Value of property sqlType.
179:             *
180:             */
181:            public String getSqlType() {
182:                return this .sqlType;
183:            }
184:
185:            /** Getter for property primary Key
186:             * @return Value of primary key.
187:             *
188:             */
189:            public boolean isPrimaryKey() {
190:                return this .primaryKey;
191:            }
192:
193:            /** Setter for the primary key.
194:             * @param value to true if column is a primary key column
195:             *
196:             */
197:            public void setPrimaryKey(boolean value) {
198:                this .primaryKey = value;
199:            }
200:
201:            /**
202:             * Gets the 'nullableString' property as a boolean.
203:             *
204:             * @return the boolean interpretation of the 'nullableString' property.
205:             */
206:            public boolean isNullable() {
207:                return nullable;
208:            }
209:
210:            /**
211:             * Sets the 'nullable' property with a value from a database columns dumo.
212:             * @param nullable set to <code>true</code> if the column is nullable.
213:             */
214:            public void setNullable(boolean nullable) {
215:                this .nullable = nullable;
216:            }
217:
218:            /** @see {@link java.lang.Object#toString()}. */
219:            public String toString() {
220:                return "Column(name=" + name + ", sqlType=" + sqlType
221:                        + ", precision=" + precision + ", scale=" + scale
222:                        + ", length=" + length + ", primaryKey=" + primaryKey
223:                        + ", nullable=" + nullable + ")";
224:            }
225:
226:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.