3232public class ColumnBuilder {
3333
3434 /** name of the new column */
35- private String _name ;
35+ private String name ;
3636 /** the type of the new column */
37- private DataType _type ;
37+ private DataType type ;
3838 /** optional length for the new column */
39- private Short _length ;
39+ private Short length ;
4040 /** optional precision for the new column */
41- private Byte _precision ;
41+ private Byte precision ;
4242 /** optional scale for the new column */
43- private Byte _scale ;
43+ private Byte scale ;
4444 /** whether or not the column is auto-number */
45- private boolean _autoNumber ;
45+ private boolean autoNumber ;
4646 /** whether or not the column allows compressed unicode */
47- private boolean _compressedUnicode ;
47+ private boolean compressedUnicode ;
4848 /** whether or not the column is calculated */
49- private boolean _calculated ;
49+ private boolean calculated ;
5050 /** whether or not the column is a hyperlink (memo only) */
51- private boolean _hyperlink ;
51+ private boolean hyperlink ;
5252 /** 0-based column number */
53- private short _columnNumber ;
53+ private short columnNumber ;
5454 /** the collating sort order for a text field */
55- private ColumnImpl .SortOrder _sortOrder ;
55+ private ColumnImpl .SortOrder sortOrder ;
5656 /** table properties (if any) */
57- private Map <String , PropertyMap .Property > _props ;
57+ private Map <String , PropertyMap .Property > props ;
5858
5959 public ColumnBuilder (String name ) {
6060 this (name , null );
6161 }
6262
6363 public ColumnBuilder (String name , DataType type ) {
64- _name = name ;
65- _type = type ;
64+ this . name = name ;
65+ this . type = type ;
6666 }
6767
6868 public String getName () {
69- return _name ;
69+ return name ;
7070 }
7171
7272 /**
7373 * Sets the type for the new column.
7474 */
7575 public ColumnBuilder withType (DataType type ) {
76- _type = type ;
76+ this . type = type ;
7777 return this ;
7878 }
7979
8080 public DataType getType () {
81- return _type ;
81+ return type ;
8282 }
8383
8484 /**
@@ -107,21 +107,21 @@ public ColumnBuilder withSqlType(int type, int lengthInUnits, FileFormat fileFor
107107 * Sets the precision for the new column.
108108 */
109109 public ColumnBuilder withPrecision (int newPrecision ) {
110- _precision = (byte ) newPrecision ;
110+ precision = (byte ) newPrecision ;
111111 return this ;
112112 }
113113
114114 public byte getPrecision () {
115- return _precision != null ? _precision : (byte ) _type .getDefaultPrecision ();
115+ return precision != null ? precision : (byte ) type .getDefaultPrecision ();
116116 }
117117
118118 /**
119119 * Sets the precision for the new column to the max length for the type. Does nothing for types which do not have a
120120 * precision.
121121 */
122122 public ColumnBuilder withMaxPrecision () {
123- if (_type .getHasScalePrecision ()) {
124- withPrecision (_type .getMaxPrecision ());
123+ if (type .getHasScalePrecision ()) {
124+ withPrecision (type .getMaxPrecision ());
125125 }
126126 return this ;
127127 }
@@ -130,21 +130,21 @@ public ColumnBuilder withMaxPrecision() {
130130 * Sets the scale for the new column.
131131 */
132132 public ColumnBuilder withScale (int newScale ) {
133- _scale = (byte ) newScale ;
133+ scale = (byte ) newScale ;
134134 return this ;
135135 }
136136
137137 public byte getScale () {
138- return _scale != null ? _scale : (byte ) _type .getDefaultScale ();
138+ return scale != null ? scale : (byte ) type .getDefaultScale ();
139139 }
140140
141141 /**
142142 * Sets the scale for the new column to the max length for the type. Does nothing for types which do not have a
143143 * scale.
144144 */
145145 public ColumnBuilder withMaxScale () {
146- if (_type .getHasScalePrecision ()) {
147- withScale (_type .getMaxScale ());
146+ if (type .getHasScalePrecision ()) {
147+ withScale (type .getMaxScale ());
148148 }
149149 return this ;
150150 }
@@ -153,19 +153,19 @@ public ColumnBuilder withMaxScale() {
153153 * Sets the length (in bytes) for the new column.
154154 */
155155 public ColumnBuilder withLength (int length ) {
156- _length = (short ) length ;
156+ this . length = (short ) length ;
157157 return this ;
158158 }
159159
160160 public short getLength () {
161- return _length != null ? _length : (short ) (!_type .isVariableLength () ? _type .getFixedSize () : _type .getDefaultSize ());
161+ return length != null ? length : (short ) (!type .isVariableLength () ? type .getFixedSize () : type .getDefaultSize ());
162162 }
163163
164164 /**
165165 * Sets the length (in type specific units) for the new column.
166166 */
167167 public ColumnBuilder withLengthInUnits (int unitLength ) {
168- return withLength (_type .fromUnitSize (unitLength ));
168+ return withLength (type .fromUnitSize (unitLength ));
169169 }
170170
171171 /**
@@ -174,8 +174,8 @@ public ColumnBuilder withLengthInUnits(int unitLength) {
174174 */
175175 public ColumnBuilder withMaxLength () {
176176 // length setting only makes sense for variable length columns
177- if (_type .isVariableLength ()) {
178- withLength (_type .getMaxSize ());
177+ if (type .isVariableLength ()) {
178+ withLength (type .getMaxSize ());
179179 }
180180 return this ;
181181 }
@@ -184,36 +184,36 @@ public ColumnBuilder withMaxLength() {
184184 * Sets whether of not the new column is an auto-number column.
185185 */
186186 public ColumnBuilder withAutoNumber (boolean autoNumber ) {
187- _autoNumber = autoNumber ;
187+ this . autoNumber = autoNumber ;
188188 return this ;
189189 }
190190
191191 public boolean isAutoNumber () {
192- return _autoNumber ;
192+ return autoNumber ;
193193 }
194194
195195 /**
196196 * Sets whether of not the new column allows unicode compression.
197197 */
198198 public ColumnBuilder withCompressedUnicode (boolean compressedUnicode ) {
199- _compressedUnicode = compressedUnicode ;
199+ this . compressedUnicode = compressedUnicode ;
200200 return this ;
201201 }
202202
203203 public boolean isCompressedUnicode () {
204- return _compressedUnicode ;
204+ return compressedUnicode ;
205205 }
206206
207207 /**
208208 * Sets whether of not the new column is a calculated column.
209209 */
210210 public ColumnBuilder withCalculated (boolean calculated ) {
211- _calculated = calculated ;
211+ this . calculated = calculated ;
212212 return this ;
213213 }
214214
215215 public boolean isCalculated () {
216- return _calculated ;
216+ return calculated ;
217217 }
218218
219219 /**
@@ -234,12 +234,12 @@ public boolean isVariableLength() {
234234 * Sets whether of not the new column allows unicode compression.
235235 */
236236 public ColumnBuilder withHyperlink (boolean hyperlink ) {
237- _hyperlink = hyperlink ;
237+ this . hyperlink = hyperlink ;
238238 return this ;
239239 }
240240
241241 public boolean isHyperlink () {
242- return _hyperlink ;
242+ return hyperlink ;
243243 }
244244
245245 /**
@@ -259,21 +259,21 @@ public ColumnBuilder withProperty(String name, DataType type, Object value) {
259259 }
260260
261261 public Map <String , PropertyMap .Property > getProperties () {
262- return _props ;
262+ return props ;
263263 }
264264
265265 private void setProperty (String name , PropertyMap .Property prop ) {
266266 if (prop == null ) {
267267 return ;
268268 }
269- if (_props == null ) {
270- _props = new HashMap <>();
269+ if (props == null ) {
270+ props = new HashMap <>();
271271 }
272- _props .put (name , prop );
272+ props .put (name , prop );
273273 }
274274
275275 private PropertyMap .Property getProperty (String name ) {
276- return _props != null ? _props .get (name ) : null ;
276+ return props != null ? props .get (name ) : null ;
277277 }
278278
279279 /**
@@ -311,20 +311,20 @@ public ColumnBuilder withFromColumn(Column template) throws IOException {
311311 */
312312 public ColumnBuilder withFromColumn (ColumnBuilder template ) {
313313 DataType type = template .getType ();
314- _type = type ;
315- _length = template ._length ;
316- _autoNumber = template ._autoNumber ;
314+ this . type = type ;
315+ length = template .length ;
316+ autoNumber = template .autoNumber ;
317317 if (type .getHasScalePrecision ()) {
318- _scale = template ._scale ;
319- _precision = template ._precision ;
318+ scale = template .scale ;
319+ precision = template .precision ;
320320 }
321- _calculated = template ._calculated ;
322- _compressedUnicode = template ._compressedUnicode ;
323- _hyperlink = template ._hyperlink ;
324- _sortOrder = template ._sortOrder ;
321+ calculated = template .calculated ;
322+ compressedUnicode = template .compressedUnicode ;
323+ hyperlink = template .hyperlink ;
324+ sortOrder = template .sortOrder ;
325325
326- if (template ._props != null ) {
327- _props = new HashMap <>(template ._props );
326+ if (template .props != null ) {
327+ props = new HashMap <>(template .props );
328328 }
329329
330330 return this ;
@@ -334,32 +334,32 @@ public ColumnBuilder withFromColumn(ColumnBuilder template) {
334334 * Escapes the new column's name using {@link TableBuilder#escapeIdentifier}.
335335 */
336336 public ColumnBuilder escapeName () {
337- _name = TableBuilder .escapeIdentifier (_name );
337+ name = TableBuilder .escapeIdentifier (name );
338338 return this ;
339339 }
340340
341341 public short getColumnNumber () {
342- return _columnNumber ;
342+ return columnNumber ;
343343 }
344344
345345 public void setColumnNumber (short newColumnNumber ) {
346- _columnNumber = newColumnNumber ;
346+ columnNumber = newColumnNumber ;
347347 }
348348
349349 public ColumnImpl .SortOrder getTextSortOrder () {
350- return _sortOrder ;
350+ return sortOrder ;
351351 }
352352
353353 public void setTextSortOrder (ColumnImpl .SortOrder newTextSortOrder ) {
354- _sortOrder = newTextSortOrder ;
354+ sortOrder = newTextSortOrder ;
355355 }
356356
357357 public boolean storeInNullMask () {
358358 return (getType () == DataType .BOOLEAN );
359359 }
360360
361361 public int getFixedDataSize () {
362- return _type .getFixedSize (_length );
362+ return type .getFixedSize (length );
363363 }
364364
365365 /**
@@ -474,16 +474,16 @@ private String withErrorContext(String msg) {
474474 @ Override
475475 public String toString () {
476476 return new StringJoiner (", " , getClass ().getSimpleName () + "[" , "]" )
477- .add ("name=" + _name )
478- .add ("type=" + _type )
479- .add ("length=" + _length )
480- .add ("precision=" + _precision )
481- .add ("scale=" + _scale )
482- .add ("autoNumber=" + _autoNumber )
483- .add ("compressedUnicode=" + _compressedUnicode )
484- .add ("calculated=" + _calculated )
485- .add ("hyperlink=" + _hyperlink )
486- .add ("props=" + _props )
477+ .add ("name=" + name )
478+ .add ("type=" + type )
479+ .add ("length=" + length )
480+ .add ("precision=" + precision )
481+ .add ("scale=" + scale )
482+ .add ("autoNumber=" + autoNumber )
483+ .add ("compressedUnicode=" + compressedUnicode )
484+ .add ("calculated=" + calculated )
485+ .add ("hyperlink=" + hyperlink )
486+ .add ("props=" + props )
487487 .toString ();
488488 }
489489
0 commit comments