Package io.debezium.relational
Class NoOpTableEditorImpl
- java.lang.Object
-
- io.debezium.relational.NoOpTableEditorImpl
-
- All Implemented Interfaces:
TableEditor
final class NoOpTableEditorImpl extends Object implements TableEditor
-
-
Field Summary
Fields Modifier and Type Field Description private String
defaultCharsetName
private TableId
id
private boolean
uniqueValues
-
Constructor Summary
Constructors Modifier Constructor Description protected
NoOpTableEditorImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TableEditor
addColumns(Column... columns)
Add one or more columns to this table, regardless of theposition
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 theposition
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 adefault character set
has been set on this table.boolean
hasUniqueValues()
Determine whether this table's primary key contains all columns (viaTableEditor.setUniqueValues()
) such that all rows within the table are unique.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(String... pkColumnNames)
Set the columns that make up this table's primary key.TableEditor
setPrimaryKeyNames(List<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 column)
Update the column with the given name.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.debezium.relational.TableEditor
addColumn, columnNames, hasPrimaryKey
-
-
-
-
Method Detail
-
tableId
public TableId tableId()
Description copied from interface:TableEditor
Get the identifier for this table.- Specified by:
tableId
in interfaceTableEditor
- Returns:
- the table identifier; may be null if not set
-
tableId
public TableEditor tableId(TableId id)
Description copied from interface:TableEditor
Set the table identifier.- Specified by:
tableId
in interfaceTableEditor
- Parameters:
id
- the table identifier- Returns:
- this editor so callers can chain methods together
-
columns
public List<Column> columns()
Description copied from interface:TableEditor
Get the definitions for the columns in this table. The resulting list should not be modified directly; instead, the column definitions should be defined withTableEditor.addColumns(Column...)
,TableEditor.addColumns(Iterable)
,TableEditor.setColumns(Column...)
,TableEditor.setColumns(Iterable)
, orTableEditor.removeColumn(String)
.- Specified by:
columns
in interfaceTableEditor
- Returns:
- the ordered list of definitions; never null
-
columnWithName
public Column columnWithName(String name)
Description copied from interface:TableEditor
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 interfaceTableEditor
- 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
public List<String> primaryKeyColumnNames()
Description copied from interface:TableEditor
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 withTableEditor.setPrimaryKeyNames(String...)
.- Specified by:
primaryKeyColumnNames
in interfaceTableEditor
- Returns:
- the list of column names that make up the primary key; never null but possibly empty
-
addColumns
public TableEditor addColumns(Column... columns)
Description copied from interface:TableEditor
Add one or more columns to this table, regardless of theposition
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 interfaceTableEditor
- Parameters:
columns
- the definitions for the columns to be added- Returns:
- this editor so callers can chain methods together
-
addColumns
public TableEditor addColumns(Iterable<Column> columns)
Description copied from interface:TableEditor
Add one or more columns to the end of this table's list of columns, regardless of theposition
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 interfaceTableEditor
- Parameters:
columns
- the definitions for the columns to be added- Returns:
- this editor so callers can chain methods together
-
setColumns
public TableEditor setColumns(Column... columns)
Description copied from interface:TableEditor
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 interfaceTableEditor
- Parameters:
columns
- the definitions for the columns to be added- Returns:
- this editor so callers can chain methods together
-
setColumns
public TableEditor setColumns(Iterable<Column> columns)
Description copied from interface:TableEditor
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 interfaceTableEditor
- Parameters:
columns
- the definitions for the columns to be added- Returns:
- this editor so callers can chain methods together
-
setPrimaryKeyNames
public TableEditor setPrimaryKeyNames(String... pkColumnNames)
Description copied from interface:TableEditor
Set the columns that make up this table's primary key.- Specified by:
setPrimaryKeyNames
in interfaceTableEditor
- Parameters:
pkColumnNames
- the names of this tables columns that make up the primary key- Returns:
- this editor so callers can chain methods together
-
setPrimaryKeyNames
public TableEditor setPrimaryKeyNames(List<String> pkColumnNames)
Description copied from interface:TableEditor
Set the columns that make up this table's primary key.- Specified by:
setPrimaryKeyNames
in interfaceTableEditor
- Parameters:
pkColumnNames
- the names of this tables columns that make up the primary key- Returns:
- this editor so callers can chain methods together
-
setUniqueValues
public TableEditor setUniqueValues()
Description copied from interface:TableEditor
Sets this table's primary key to contain all columns, ensuring that all values are unique within the table. This is analogous to callingsetPrimaryKeyNames(columnNames())
except that the primary key is updated when columns are added or removed.- Specified by:
setUniqueValues
in interfaceTableEditor
- Returns:
- this editor so callers can chain methods together
-
hasUniqueValues
public boolean hasUniqueValues()
Description copied from interface:TableEditor
Determine whether this table's primary key contains all columns (viaTableEditor.setUniqueValues()
) such that all rows within the table are unique.- Specified by:
hasUniqueValues
in interfaceTableEditor
- Returns:
true
ifTableEditor.setUniqueValues()
was last called on this table, orfalse
otherwise
-
setDefaultCharsetName
public TableEditor setDefaultCharsetName(String charsetName)
Description copied from interface:TableEditor
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 interfaceTableEditor
- 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()
Description copied from interface:TableEditor
Determine if adefault character set
has been set on this table.- Specified by:
hasDefaultCharsetName
in interfaceTableEditor
- Returns:
true
if this has a default character set, orfalse
if one has not yet been set
-
removeColumn
public TableEditor removeColumn(String columnName)
Description copied from interface:TableEditor
Remove the column with the given name. This method does nothing if no such column exists.- Specified by:
removeColumn
in interfaceTableEditor
- Parameters:
columnName
- the name of the column to be removed- Returns:
- this editor so callers can chain methods together
-
updateColumn
public TableEditor updateColumn(Column column)
Description copied from interface:TableEditor
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 interfaceTableEditor
- Parameters:
column
- the new column definition- Returns:
- this editor so callers can chain methods together
-
reorderColumn
public TableEditor reorderColumn(String columnName, String afterColumnName)
Description copied from interface:TableEditor
Reorder the column with the given name to be positioned after the designated column. IfafterColumnName
is null, the column will be moved to the first column.- Specified by:
reorderColumn
in interfaceTableEditor
- Parameters:
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 column- Returns:
- this editor so callers can chain methods together
-
renameColumn
public TableEditor renameColumn(String existingName, String newName)
Description copied from interface:TableEditor
Rename the column with the given name to the new specified name.- Specified by:
renameColumn
in interfaceTableEditor
- Parameters:
existingName
- the existing name of the column to be renamed; may not be nullnewName
- the new name of the column; may not be null- Returns:
- this editor so callers can chain methods together
-
create
public Table create()
Description copied from interface:TableEditor
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 interfaceTableEditor
- Returns:
- the immutable table definition; never null
-
-