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 long length = -1;
34 private int precision = -1;
35 private int scale = -1;
36
37
38
39
40 private String source = "";
41
42 public DataType() {
43 super();
44 }
45
46 public DataType( String theName ) {
47 super();
48 this.name = theName;
49 }
50
51 public DataType( String name,
52 int length ) {
53 super();
54 this.name = name;
55 this.length = length;
56 }
57
58 public DataType( String name,
59 int precision,
60 int scale ) {
61 super();
62 this.name = name;
63 this.precision = precision;
64 this.scale = scale;
65 }
66
67 public String getName() {
68 return this.name;
69 }
70
71 public void setName( String value ) {
72 this.name = value;
73 }
74
75 public void setLength( long value ) {
76 this.length = value;
77 }
78
79 public long getLength() {
80 return this.length;
81 }
82
83 public void setPrecision( int value ) {
84 this.precision = value;
85 }
86
87 public int getPrecision() {
88 return this.precision;
89 }
90
91 public int getScale() {
92 return this.scale;
93 }
94
95 public void setScale( int value ) {
96 this.scale = value;
97 }
98
99 @Override
100 public String toString() {
101 StringBuffer result = new StringBuffer(100);
102 result.append("DataType()").append(" ").append(name);
103
104 return result.toString();
105 }
106
107
108
109
110 public void setSource( String source ) {
111 if (source == null) {
112 source = "";
113 }
114 this.source = source;
115 }
116
117
118
119
120 public String getSource() {
121 return source;
122 }
123
124
125
126
127
128 public void appendSource( boolean addSpaceBefore,
129 String value ) {
130 if (addSpaceBefore) {
131 this.source = this.source + DdlConstants.SPACE;
132 }
133 this.source = this.source + value;
134 }
135
136
137
138
139
140
141 public void appendSource( boolean addSpaceBefore,
142 String value,
143 String... additionalStrs ) {
144 if (addSpaceBefore) {
145 this.source = this.source + DdlConstants.SPACE;
146 }
147 this.source = this.source + value;
148 }
149
150 }