1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package org.modeshape.sequencer.ddl.datatype;
25
26 import org.modeshape.sequencer.ddl.DdlConstants;
27
28
29
30
31 public class DataType {
32 private String name;
33 private int length = -1;
34 private int precision = -1;
35 private int scale = -1;
36 private boolean isKMGLength = false;
37 private String kmgValue = null;
38
39
40
41
42 private String source = "";
43
44 public DataType() {
45 super();
46 }
47
48 public DataType( String theName ) {
49 super();
50 this.name = theName;
51 }
52
53 public DataType( String name,
54 int length ) {
55 super();
56 this.name = name;
57 this.length = length;
58 }
59
60 public DataType( String name,
61 int precision,
62 int scale ) {
63 super();
64 this.name = name;
65 this.precision = precision;
66 this.scale = scale;
67 }
68
69 public String getName() {
70 return this.name;
71 }
72
73 public void setName( String value ) {
74 this.name = value;
75 }
76
77 public void setLength( int value ) {
78 this.length = value;
79 }
80
81 public int getLength() {
82 return this.length;
83 }
84
85 public void setPrecision( int value ) {
86 this.precision = value;
87 }
88
89 public int getPrecision() {
90 return this.precision;
91 }
92
93 public int getScale() {
94 return this.scale;
95 }
96
97 public void setScale( int value ) {
98 this.scale = value;
99 }
100
101 @Override
102 public String toString() {
103 StringBuffer result = new StringBuffer(100);
104 result.append("DataType()").append(" ").append(name);
105
106 return result.toString();
107 }
108
109 public boolean isKMGLength() {
110 return isKMGLength;
111 }
112
113 public void setKMGLength( boolean isKMGLength ) {
114 this.isKMGLength = isKMGLength;
115 }
116
117 public String getKMGValue() {
118 return kmgValue;
119 }
120
121 public void setKMGValue( String kmgValue ) {
122 this.kmgValue = kmgValue;
123 }
124
125
126
127
128 public void setSource( String source ) {
129 if (source == null) {
130 source = "";
131 }
132 this.source = source;
133 }
134
135
136
137
138 public String getSource() {
139 return source;
140 }
141
142
143
144
145
146 public void appendSource( boolean addSpaceBefore,
147 String value ) {
148 if (addSpaceBefore) {
149 this.source = this.source + DdlConstants.SPACE;
150 }
151 this.source = this.source + value;
152 }
153
154
155
156
157
158
159 public void appendSource( boolean addSpaceBefore,
160 String value,
161 String... additionalStrs ) {
162 if (addSpaceBefore) {
163 this.source = this.source + DdlConstants.SPACE;
164 }
165 this.source = this.source + value;
166 }
167
168 }