|
11 | 11 |
|
12 | 12 | import java.util.ArrayList; |
13 | 13 | import java.util.Arrays; |
14 | | -import java.util.Collections; |
15 | 14 | import java.util.List; |
16 | 15 | import net.sf.jsqlparser.statement.create.table.ColDataType; |
| 16 | +import net.sf.jsqlparser.statement.create.table.ColumnDefinition; |
17 | 17 | import net.sf.jsqlparser.statement.create.table.Index; |
18 | 18 | import net.sf.jsqlparser.statement.select.PlainSelect; |
19 | 19 |
|
@@ -320,49 +320,21 @@ public String toString() { |
320 | 320 | return b.toString(); |
321 | 321 | } |
322 | 322 |
|
323 | | - public static class ColumnDataType { |
324 | | - |
325 | | - private final String columnName; |
| 323 | + public final static class ColumnDataType extends ColumnDefinition { |
326 | 324 | private final boolean withType; |
327 | | - private final ColDataType colDataType; |
328 | | - private final List<String> columnSpecs; |
329 | 325 |
|
330 | 326 | public ColumnDataType(String columnName, boolean withType, ColDataType colDataType, List<String> columnSpecs) { |
331 | | - this.columnName = columnName; |
| 327 | + super(columnName, colDataType, columnSpecs); |
332 | 328 | this.withType = withType; |
333 | | - this.colDataType = colDataType; |
334 | | - this.columnSpecs = columnSpecs; |
335 | | - } |
336 | | - |
337 | | - public String getColumnName() { |
338 | | - return columnName; |
339 | | - } |
340 | | - |
341 | | - public ColDataType getColDataType() { |
342 | | - return colDataType; |
343 | | - } |
344 | | - |
345 | | - public List<String> getColumnSpecs() { |
346 | | - if (columnSpecs == null) { |
347 | | - return Collections.emptyList(); |
348 | | - } |
349 | | - return Collections.unmodifiableList(columnSpecs); |
350 | 329 | } |
351 | 330 |
|
352 | 331 | @Override |
353 | 332 | public String toString() { |
354 | | - return columnName + (withType ? " TYPE " : " ") + colDataType + parametersToString(); |
355 | | - } |
356 | | - |
357 | | - private String parametersToString() { |
358 | | - if (columnSpecs == null || columnSpecs.isEmpty()) { |
359 | | - return ""; |
360 | | - } |
361 | | - return " " + PlainSelect.getStringList(columnSpecs, false, false); |
| 333 | + return getColumnName() + (withType ? " TYPE " : " ") + toStringDataTypeAndSpec(); |
362 | 334 | } |
363 | 335 | } |
364 | 336 |
|
365 | | - public static class ColumnDropNotNull { |
| 337 | + public final static class ColumnDropNotNull { |
366 | 338 |
|
367 | 339 | private final String columnName; |
368 | 340 | private final boolean withNot; |
|
0 commit comments