1 /*
2 * Created on 2003-6-11 11:07:47 by joel guo
3 *
4 * vTradEx Information Technology Inc.
5 */
6 package com.cyclops.dbdigger.schema;
7 import org.apache.commons.lang.StringUtils;
8 /*** Add description <font color="red">HERE</font>!
9 *
10 * @author <a href="mailto:joeblack.guo@vtradex.com">joel guo</a>
11 * @since 2003-6-11 11:07:47
12 */
13 public class DefaultColumn implements Column {
14 private DBType dbtype = UnknownType.INSTANCE;
15 private String defaultValue;
16 private String description;
17 private boolean hasDefaultValue;
18 private boolean isPrimaryKey;
19 private boolean isRequired;
20 private String javaPropertyName;
21 private String name;
22 private int size;
23 private Table table;
24 private String type;
25 /*** Method getDbtype()
26 * @return DBType object
27 */
28 public DBType getDBType() {
29 return dbtype;
30 }
31 /*** Override method getDefaultValue() in super class
32 * @see com.cyclops.dbdigger.schema.Column#getDefaultValue()
33 */
34 public String getDefaultValue() {
35 return defaultValue;
36 }
37 /*** Override method getDescription() of super class
38 * @see com.cyclops.dbdigger.schema.Column#getDescription()
39 */
40 public String getDescription() {
41 return description;
42 }
43 /*** Override method getJavaPropertyName() in super class
44 * @see com.cyclops.dbdigger.schema.Column#getJavaPropertyName()
45 */
46 public String getJavaPropertyName() {
47 return javaPropertyName;
48 }
49 /*** Override method getName() in super class
50 * @see com.cyclops.dbdigger.schema.Column#getName()
51 */
52 public String getName() {
53 return name;
54 }
55 /*** Method getSize()
56 * @return Size of this column
57 */
58 public int getSize() {
59 return size;
60 }
61 /*** Override method getTable() in super class
62 * @see com.cyclops.dbdigger.schema.Column#getTable()
63 */
64 public Table getTable() {
65 return table;
66 }
67 /*** Method getType()
68 * @return Type name
69 */
70 public String getType() {
71 return type;
72 }
73 /*** Override method getType() in super class
74 * @see com.cyclops.dbdigger.schema.Column#getType()
75 */
76 /*
77 public Type getType() {
78 return type;
79 }*/
80 /*** Override method hasDefaultValue() in super class
81 * @see com.cyclops.dbdigger.schema.Column#hasDefaultValue()
82 */
83 public boolean hasDefaultValue() {
84 return hasDefaultValue;
85 }
86 /*** Override method isPrimaryKey() in super class
87 * @see com.cyclops.dbdigger.schema.Column#isPrimaryKey()
88 */
89 public boolean isPrimaryKey() {
90 return isPrimaryKey;
91 }
92 /*** Override method isRequired() in super class
93 * @see com.cyclops.dbdigger.schema.Column#isRequired()
94 */
95 public boolean isRequired() {
96 return isRequired;
97 }
98 /*** Method setDbtype()
99 * @param atype DBType object
100 */
101 public void setDBType(DBType atype) {
102 dbtype = atype;
103 }
104 /*** Method setDefaultValue() in class DefaultColumn
105 * @param string Default value of this column
106 */
107 public void setDefaultValue(String string) {
108 if (!StringUtils.isEmpty(string)) {
109 hasDefaultValue = true;
110 }
111 defaultValue = string;
112 }
113 /*** Method setDescription()
114 * @param string Description of this column
115 */
116 public void setDescription(String string) {
117 description = string;
118 }
119 /*** Method setJavaPropertyName() in class DefaultColumn
120 * @param string Java property name
121 */
122 public void setJavaPropertyName(String string) {
123 javaPropertyName = string;
124 }
125 /*** Method setName() in class DefaultColumn
126 * @param string Name of this column
127 */
128 public void setName(String string) {
129 name = string;
130 if (StringUtils.isEmpty(javaPropertyName)) {
131 //TODO Convert column name into java name
132 javaPropertyName = StringUtils.capitaliseAllWords(name);
133 }
134 }
135 /*** Method setPrimaryKey() in class DefaultColumn
136 * @param b Is this column primary key
137 */
138 public void setPrimaryKey(boolean b) {
139 isPrimaryKey = b;
140 }
141 /*** Method setRequired() in class DefaultColumn
142 * @param b Is this column required
143 */
144 public void setRequired(boolean b) {
145 isRequired = b;
146 }
147 /*** Method setSize()
148 * @param i Size of this column
149 */
150 public void setSize(int i) {
151 size = i;
152 }
153 /*** Method setTable() in class DefaultColumn
154 * @param atable Table object of this column
155 */
156 public void setTable(Table atable) {
157 table = atable;
158 }
159 /*** Method setType()
160 * @param string Type name
161 */
162 public void setType(String string) {
163 type = string;
164 }
165 }
This page was automatically generated by Maven