1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.fatwire.gst.foundation.facade.sql.table;
18
19
20
21
22
23
24
25
26
27 public class TableColumn {
28
29 public enum Type {
30 ccchar("cc.char"), ccvarchar("cc.varchar"), ccbigtext("cc.bigtext"), ccsmallint("cc.smallint"), ccinteger(
31 "cc.integer"), ccbigint("cc.bigint"), ccnumeric("cc.numeric"), ccdouble("cc.double"), ccdatetime(
32 "cc.datetime"), ccblob("cc.blob");
33
34 private final String prop;
35
36 Type(String prop) {
37 this.prop = prop;
38 }
39
40 public String getProperty() {
41 return prop;
42 }
43
44 }
45
46 private final String name;
47
48 private final Type type;
49
50 private final boolean primary;
51
52 private boolean unique;
53
54 private int length;
55
56 private int decimal;
57
58 private boolean nullable;
59
60 public TableColumn(final String name, final Type type) {
61 this(name, type, false);
62 }
63
64 public TableColumn(final String name, final Type type, final boolean primary) {
65 super();
66 this.name = name;
67 this.primary = primary;
68 this.type = type;
69 }
70
71 public int getDecimal() {
72 return decimal;
73 }
74
75 public TableColumn setDecimal(int decimal) {
76 this.decimal = decimal;
77 return this;
78 }
79
80 public int getLength() {
81 return length;
82 }
83
84 public TableColumn setLength(int length) {
85 this.length = length;
86 return this;
87 }
88
89 public boolean isNullable() {
90 return nullable;
91 }
92
93 public TableColumn setNullable(boolean nullable) {
94 this.nullable = nullable;
95 return this;
96 }
97
98 public boolean isPrimary() {
99 return primary;
100 }
101
102 public String getName() {
103 return name;
104 }
105
106 public Type getType() {
107 return type;
108 }
109
110 public boolean isUnique() {
111 return unique;
112 }
113
114 public TableColumn setUnique(boolean unique) {
115 this.unique = unique;
116 return this;
117 }
118
119 }