Constructor Summary
Constructors
Method Summary
All Methods Instance Methods Concrete Methods
protected void
Add one or more columns to this table, regardless of the
position
of the supplied
columns.
Add one or more columns to the end of this table's list of columns, regardless of the
position
of the supplied columns.
Get the definitions for the columns in this table.
Get the definition for the column in this table with the supplied name.
Obtain an immutable table definition representing the current state of this editor.
protected boolean
boolean
Determine if a
comment
has been set on this table.
boolean
boolean
Determine whether this table's primary key contains all columns (via
TableEditor.setUniqueValues()
) such that all rows
within the table are unique.
protected boolean
The list of column names that make up the primary key for this table.
Remove the column with the given name.
Rename the column with the given name to the new specified name.
Reorder the column with the given name to be positioned after the designated column.
Set this table's column definitions.
Set this table's column definitions.
Set the comment of the table
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.
Set the columns that make up this table's primary key.
Set the columns that make up this table's primary key.
Sets this table's primary key to contain all columns, ensuring that all values are unique within the table.
Get the identifier for this table.
Set the table identifier.
Update the column with the given name.
protected void
protected void
Field Details
uniqueValues
private boolean uniqueValues
defaultCharsetName
private String defaultCharsetName
Constructor Details
TableEditorImpl
protected TableEditorImpl ()
Method Details
tableId
Get the identifier for this table.
Specified by:
tableId
in interface TableEditor
Returns:
the table identifier; may be null if not set
tableId
Set the table identifier.
Specified by:
tableId
in interface TableEditor
Parameters:
id
- the table identifier
Returns:
this editor so callers can chain methods together
columns
Specified by:
columns
in interface TableEditor
Returns:
the ordered list of definitions; never null
columnWithName
Get the definition for the column in this table with the supplied name. The case of the supplied name does not matter.
Specified by:
columnWithName
in interface TableEditor
Parameters:
name
- the case-insensitive name of the column
Returns:
the column definition, or null if there is no column with the given name
hasColumnWithName
protected boolean hasColumnWithName (String name)
primaryKeyColumnNames
The list of column names that make up the primary key for this table. The resulting list should not be modified directly;
instead, the set of primary key names should be defined with
TableEditor.setPrimaryKeyNames(String...)
.
Specified by:
primaryKeyColumnNames
in interface TableEditor
Returns:
the list of column names that make up the primary key; never null but possibly empty
addColumns
Add one or more columns to this table, regardless of the
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.
Specified by:
addColumns
in interface TableEditor
Parameters:
columns
- the definitions for the columns to be added
Returns:
this editor so callers can chain methods together
addColumns
Add one or more columns to the end of this table's list of columns, regardless of the
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.
Specified by:
addColumns
in interface TableEditor
Parameters:
columns
- the definitions for the columns to be added
Returns:
this editor so callers can chain methods together
add
protected void add (Column defn)
setColumns
Set this table's column definitions. The table's primary key columns may be removed as a result of this method if they
refer to columns that are not in the supplied list of column definitions.
Specified by:
setColumns
in interface TableEditor
Parameters:
columns
- the definitions for the columns to be added
Returns:
this editor so callers can chain methods together
setColumns
Set this table's column definitions. The table's primary key columns may be removed as a result of this method if they
refer to columns that are not in the supplied list of column definitions.
Specified by:
setColumns
in interface TableEditor
Parameters:
columns
- the definitions for the columns to be added
Returns:
this editor so callers can chain methods together
updatePrimaryKeys
protected void updatePrimaryKeys ()
setPrimaryKeyNames
Set the columns that make up this table's primary key.
Specified by:
setPrimaryKeyNames
in interface TableEditor
Parameters:
pkColumnNames
- the names of this tables columns that make up the primary key
Returns:
this editor so callers can chain methods together
setPrimaryKeyNames
Set the columns that make up this table's primary key.
Specified by:
setPrimaryKeyNames
in interface TableEditor
Parameters:
pkColumnNames
- the names of this tables columns that make up the primary key
Returns:
this editor so callers can chain methods together
setUniqueValues
Sets this table's primary key to contain all columns, ensuring that all values are unique within the table.
This is analogous to calling setPrimaryKeyNames(columnNames())
except that the primary key is updated
when columns are added or removed.
Specified by:
setUniqueValues
in interface TableEditor
Returns:
this editor so callers can chain methods together
setDefaultCharsetName
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.
Specified by:
setDefaultCharsetName
in interface TableEditor
Parameters:
charsetName
- the name of the character set that should be used by default
Returns:
this editor so callers can chain methods together
hasDefaultCharsetName
public boolean hasDefaultCharsetName ()
Specified by:
hasDefaultCharsetName
in interface TableEditor
Returns:
true
if this has a default character set, or false
if one has not yet been set
removeColumn
Remove the column with the given name. This method does nothing if no such column exists.
Specified by:
removeColumn
in interface TableEditor
Parameters:
columnName
- the name of the column to be removed
Returns:
this editor so callers can chain methods together
updateColumn
Update the column with the given name. The existing column definition with the name as the column provided
is replaced with the new one.
Specified by:
updateColumn
in interface TableEditor
Parameters:
newColumn
- the new column definition
Returns:
this editor so callers can chain methods together
reorderColumn
Reorder the column with the given name to be positioned after the designated column. If afterColumnName
is null,
the column will be moved to the first column.
Specified by:
reorderColumn
in interface TableEditor
Parameters:
columnName
- the name of the column to be removed
afterColumnName
- 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 column
Returns:
this editor so callers can chain methods together
renameColumn
Rename the column with the given name to the new specified name.
Specified by:
renameColumn
in interface TableEditor
Parameters:
existingName
- the existing name of the column to be renamed; may not be null
newName
- the new name of the column; may not be null
Returns:
this editor so callers can chain methods together
updatePositions
protected void updatePositions ()
positionsAreValid
protected boolean positionsAreValid ()
create
Obtain an immutable table definition representing the current state of this editor. This editor can be reused
after this method, since the resulting table definition no longer refers to any of the data used in this editor.
Specified by:
create
in interface TableEditor
Returns:
the immutable table definition; never null