class TableEditorImpl extends Object implements TableEditor
Modifier and Type | Field and Description |
---|---|
private String |
defaultCharsetName |
private TableId |
id |
private List<String> |
pkColumnNames |
private LinkedHashMap<String,Column> |
sortedColumns |
private boolean |
uniqueValues |
Modifier | Constructor and Description |
---|---|
protected |
TableEditorImpl() |
Modifier and Type | Method and Description |
---|---|
protected void |
add(Column defn) |
TableEditor |
addColumns(Column... columns)
Add one or more columns to this table, regardless of the
position of the supplied
columns. |
TableEditor |
addColumns(Iterable<Column> columns)
Add one or more columns to the end of this table's list of columns, regardless of the
position of the supplied columns. |
List<Column> |
columns()
Get the definitions for the columns in this table.
|
Column |
columnWithName(String name)
Get the definition for the column in this table with the supplied name.
|
Table |
create()
Obtain an immutable table definition representing the current state of this editor.
|
protected boolean |
hasColumnWithName(String name) |
boolean |
hasDefaultCharsetName()
Determine if a
default character set has been set on this table. |
boolean |
hasUniqueValues()
Determine whether this table's primary key contains all columns (via
TableEditor.setUniqueValues() ) such that all rows
within the table are unique. |
protected boolean |
positionsAreValid() |
List<String> |
primaryKeyColumnNames()
The list of column names that make up the primary key for this table.
|
TableEditor |
removeColumn(String columnName)
Remove the column with the given name.
|
TableEditor |
renameColumn(String existingName,
String newName)
Rename the column with the given name to the new specified name.
|
TableEditor |
reorderColumn(String columnName,
String afterColumnName)
Reorder the column with the given name to be positioned after the designated column.
|
TableEditor |
setColumns(Column... columns)
Set this table's column definitions.
|
TableEditor |
setColumns(Iterable<Column> columns)
Set this table's column definitions.
|
TableEditor |
setDefaultCharsetName(String charsetName)
Set the name of the character set that should be used by default in the columns that require a character set but have
not defined one.
|
TableEditor |
setPrimaryKeyNames(List<String> pkColumnNames)
Set the columns that make up this table's primary key.
|
TableEditor |
setPrimaryKeyNames(String... pkColumnNames)
Set the columns that make up this table's primary key.
|
TableEditor |
setUniqueValues()
Sets this table's primary key to contain all columns, ensuring that all values are unique within the table.
|
TableId |
tableId()
Get the identifier for this table.
|
TableEditor |
tableId(TableId id)
Set the table identifier.
|
String |
toString() |
TableEditor |
updateColumn(Column newColumn)
Update the column with the given name.
|
protected void |
updatePositions() |
protected void |
updatePrimaryKeys() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addColumn, columnNames, hasPrimaryKey, noOp
private TableId id
private LinkedHashMap<String,Column> sortedColumns
private boolean uniqueValues
private String defaultCharsetName
public TableId tableId()
TableEditor
tableId
in interface TableEditor
public TableEditor tableId(TableId id)
TableEditor
tableId
in interface TableEditor
id
- the table identifierpublic List<Column> columns()
TableEditor
TableEditor.addColumns(Column...)
,
TableEditor.addColumns(Iterable)
, TableEditor.setColumns(Column...)
, TableEditor.setColumns(Iterable)
, or
TableEditor.removeColumn(String)
.columns
in interface TableEditor
public Column columnWithName(String name)
TableEditor
columnWithName
in interface TableEditor
name
- the case-insensitive name of the columnprotected boolean hasColumnWithName(String name)
public List<String> primaryKeyColumnNames()
TableEditor
TableEditor.setPrimaryKeyNames(String...)
.primaryKeyColumnNames
in interface TableEditor
public TableEditor addColumns(Column... columns)
TableEditor
position
of the supplied
columns. However, if an existing column definition matches a supplied column, the new column definition will replace
the existing column definition.addColumns
in interface TableEditor
columns
- the definitions for the columns to be addedpublic TableEditor addColumns(Iterable<Column> columns)
TableEditor
position
of the supplied columns. However, if an existing column definition matches a supplied column, the new column
definition will replace the existing column definition.addColumns
in interface TableEditor
columns
- the definitions for the columns to be addedprotected void add(Column defn)
public TableEditor setColumns(Column... columns)
TableEditor
setColumns
in interface TableEditor
columns
- the definitions for the columns to be addedpublic TableEditor setColumns(Iterable<Column> columns)
TableEditor
setColumns
in interface TableEditor
columns
- the definitions for the columns to be addedprotected void updatePrimaryKeys()
public TableEditor setPrimaryKeyNames(String... pkColumnNames)
TableEditor
setPrimaryKeyNames
in interface TableEditor
pkColumnNames
- the names of this tables columns that make up the primary keypublic TableEditor setPrimaryKeyNames(List<String> pkColumnNames)
TableEditor
setPrimaryKeyNames
in interface TableEditor
pkColumnNames
- the names of this tables columns that make up the primary keypublic TableEditor setUniqueValues()
TableEditor
setPrimaryKeyNames(columnNames())
except that the primary key is updated
when columns are added or removed.setUniqueValues
in interface TableEditor
public boolean hasUniqueValues()
TableEditor
TableEditor.setUniqueValues()
) such that all rows
within the table are unique.hasUniqueValues
in interface TableEditor
true
if TableEditor.setUniqueValues()
was last called on this table, or false
otherwisepublic TableEditor setDefaultCharsetName(String charsetName)
TableEditor
setDefaultCharsetName
in interface TableEditor
charsetName
- the name of the character set that should be used by defaultpublic boolean hasDefaultCharsetName()
TableEditor
default character set
has been set on this table.hasDefaultCharsetName
in interface TableEditor
true
if this has a default character set, or false
if one has not yet been setpublic TableEditor removeColumn(String columnName)
TableEditor
removeColumn
in interface TableEditor
columnName
- the name of the column to be removedpublic TableEditor updateColumn(Column newColumn)
TableEditor
updateColumn
in interface TableEditor
newColumn
- the new column definitionpublic TableEditor reorderColumn(String columnName, String afterColumnName)
TableEditor
afterColumnName
is null,
the column will be moved to the first column.reorderColumn
in interface TableEditor
columnName
- the name of the column to be removedafterColumnName
- the name of the column after which the moved column is to be positioned; may be null if the column
is to be moved to the first columnpublic TableEditor renameColumn(String existingName, String newName)
TableEditor
renameColumn
in interface TableEditor
existingName
- the existing name of the column to be renamed; may not be nullnewName
- the new name of the column; may not be nullprotected void updatePositions()
protected boolean positionsAreValid()
public Table create()
TableEditor
create
in interface TableEditor
Copyright © 2021 JBoss by Red Hat. All rights reserved.