Package io.debezium.relational
Class ColumnEditorImpl
- java.lang.Object
-
- io.debezium.relational.ColumnEditorImpl
-
- All Implemented Interfaces:
ColumnEditor
final class ColumnEditorImpl extends Object implements ColumnEditor
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
autoIncremented
private String
charsetName
private String
comment
private String
defaultValueExpression
private List<String>
enumValues
private boolean
generated
private boolean
hasDefaultValue
private int
jdbcType
private int
length
private String
name
private int
nativeType
private boolean
optional
private int
position
private Integer
scale
private String
tableCharsetName
private String
typeExpression
private String
typeName
-
Constructor Summary
Constructors Modifier Constructor Description protected
ColumnEditorImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ColumnEditorImpl
autoIncremented(boolean autoIncremented)
Set whether the column's values are automatically incremented.String
charsetName()
Get the database-specific name of the character set used by this column.ColumnEditor
charsetName(String charsetName)
Set the database-specific name of the character set used by this column.String
charsetNameOfTable()
Get the database-specific name of the character set defined by this column's table, which is used if a character set is not explicitly set on this column.ColumnEditor
charsetNameOfTable(String charsetName)
Set the database-specific name of the character set defined by this column's table.String
comment()
Get the comment of the column.ColumnEditor
comment(String comment)
Set the comment of the columnColumn
create()
Obtain an immutable column definition representing the current state of this editor.Optional<String>
defaultValueExpression()
Get the database-specific complete expression defining the column's default value.ColumnEditor
defaultValueExpression(String defaultValueExpression)
Set the default value expression of the column;List<String>
enumValues()
get the enumeration values for the column.ColumnEditor
enumValues(List<String> enumValues)
Set the list of enumeration values.ColumnEditorImpl
generated(boolean generated)
Set whether the column's values are generated by the database.boolean
hasDefaultValue()
Determine whether this column's has a default value setboolean
isAutoIncremented()
Determine whether this column's values are automatically incremented by the database.boolean
isGenerated()
Determine whether this column's values are generated by the database.boolean
isOptional()
Determine whether this column is optional.int
jdbcType()
Get theJDBC type
for this columnColumnEditorImpl
jdbcType(int jdbcType)
Set theJDBC type
of this column.int
length()
Get the maximum length of this column's values.ColumnEditorImpl
length(int length)
Set the maximum length of this column's values.String
name()
Get the name of the column.ColumnEditorImpl
name(String name)
Set the name of the column.int
nativeType()
Get the internal database-specific type identifier for this column.ColumnEditorImpl
nativeType(int nativeType)
Set the native type for this column .ColumnEditorImpl
optional(boolean optional)
Set whether the column's values are optional (e.g., can contain nulls).int
position()
Get the position of the column in the table.ColumnEditorImpl
position(int position)
Set the position of the column within the table definition.Optional<Integer>
scale()
Get the scale of the column.ColumnEditorImpl
scale(Integer scale)
Set the scale of the column.String
toString()
ColumnEditorImpl
type(String typeName)
Set the database-specific name of the column's data type.ColumnEditor
type(String typeName, String typeExpression)
Set the database-specific name of the column's data type.String
typeExpression()
Get the database-specific complete expression defining the column's data type, including dimensions, length, precision, character sets, constraints, etc.String
typeName()
Get the database-specific name of the column's data type.ColumnEditor
unsetDefaultValueExpression()
Unsets the default value expression of the column, reverting the editor to the state where {@link #defaultValueExpression(String))} has never been called
-
-
-
Field Detail
-
name
private String name
-
jdbcType
private int jdbcType
-
nativeType
private int nativeType
-
typeName
private String typeName
-
typeExpression
private String typeExpression
-
charsetName
private String charsetName
-
tableCharsetName
private String tableCharsetName
-
length
private int length
-
scale
private Integer scale
-
position
private int position
-
optional
private boolean optional
-
autoIncremented
private boolean autoIncremented
-
generated
private boolean generated
-
defaultValueExpression
private String defaultValueExpression
-
hasDefaultValue
private boolean hasDefaultValue
-
comment
private String comment
-
-
Method Detail
-
name
public String name()
Description copied from interface:ColumnEditor
Get the name of the column.- Specified by:
name
in interfaceColumnEditor
- Returns:
- the column name; may be null if not set
-
typeName
public String typeName()
Description copied from interface:ColumnEditor
Get the database-specific name of the column's data type.- Specified by:
typeName
in interfaceColumnEditor
- Returns:
- the name of the type; may be null if not set
-
typeExpression
public String typeExpression()
Description copied from interface:ColumnEditor
Get the database-specific complete expression defining the column's data type, including dimensions, length, precision, character sets, constraints, etc.- Specified by:
typeExpression
in interfaceColumnEditor
- Returns:
- the complete type expression
-
jdbcType
public int jdbcType()
Description copied from interface:ColumnEditor
Get theJDBC type
for this column- Specified by:
jdbcType
in interfaceColumnEditor
- Returns:
- the type constant
-
nativeType
public int nativeType()
Description copied from interface:ColumnEditor
Get the internal database-specific type identifier for this column.- Specified by:
nativeType
in interfaceColumnEditor
- Returns:
- a type constant for the specific database
-
charsetName
public String charsetName()
Description copied from interface:ColumnEditor
Get the database-specific name of the character set used by this column.- Specified by:
charsetName
in interfaceColumnEditor
- Returns:
- the database-specific character set name, or null if the column's data type doesn't use character sets or no character set is specified
-
charsetNameOfTable
public String charsetNameOfTable()
Description copied from interface:ColumnEditor
Get the database-specific name of the character set defined by this column's table, which is used if a character set is not explicitly set on this column.- Specified by:
charsetNameOfTable
in interfaceColumnEditor
- Returns:
- the database-specific character set name defined for this column's table, or null if not defined
-
length
public int length()
Description copied from interface:ColumnEditor
Get the maximum length of this column's values. For numeric columns, this represents the precision.- Specified by:
length
in interfaceColumnEditor
- Returns:
- the length of the column
-
scale
public Optional<Integer> scale()
Description copied from interface:ColumnEditor
Get the scale of the column.- Specified by:
scale
in interfaceColumnEditor
- Returns:
- the scale if present
-
position
public int position()
Description copied from interface:ColumnEditor
Get the position of the column in the table.- Specified by:
position
in interfaceColumnEditor
- Returns:
- the 1-based position
-
isOptional
public boolean isOptional()
Description copied from interface:ColumnEditor
Determine whether this column is optional.- Specified by:
isOptional
in interfaceColumnEditor
- Returns:
true
if it is optional, orfalse
otherwise
-
isAutoIncremented
public boolean isAutoIncremented()
Description copied from interface:ColumnEditor
Determine whether this column's values are automatically incremented by the database.- Specified by:
isAutoIncremented
in interfaceColumnEditor
- Returns:
true
if the values are auto-incremented, orfalse
otherwise
-
isGenerated
public boolean isGenerated()
Description copied from interface:ColumnEditor
Determine whether this column's values are generated by the database.- Specified by:
isGenerated
in interfaceColumnEditor
- Returns:
true
if the values are generated, orfalse
otherwise
-
defaultValueExpression
public Optional<String> defaultValueExpression()
Description copied from interface:ColumnEditor
Get the database-specific complete expression defining the column's default value.- Specified by:
defaultValueExpression
in interfaceColumnEditor
- Returns:
- the complete type expression
-
hasDefaultValue
public boolean hasDefaultValue()
Description copied from interface:ColumnEditor
Determine whether this column's has a default value set- Specified by:
hasDefaultValue
in interfaceColumnEditor
- Returns:
true
if the default value was provided, orfalse
otherwise
-
comment
public String comment()
Description copied from interface:ColumnEditor
Get the comment of the column.- Specified by:
comment
in interfaceColumnEditor
- Returns:
- the column comment; may be null if not set
-
name
public ColumnEditorImpl name(String name)
Description copied from interface:ColumnEditor
Set the name of the column.- Specified by:
name
in interfaceColumnEditor
- Parameters:
name
- the column name- Returns:
- this editor so callers can chain methods together
-
enumValues
public List<String> enumValues()
Description copied from interface:ColumnEditor
get the enumeration values for the column.- Specified by:
enumValues
in interfaceColumnEditor
- Returns:
- the list of enumeration values
-
type
public ColumnEditorImpl type(String typeName)
Description copied from interface:ColumnEditor
Set the database-specific name of the column's data type.- Specified by:
type
in interfaceColumnEditor
- Parameters:
typeName
- the column's type name- Returns:
- this editor so callers can chain methods together
-
type
public ColumnEditor type(String typeName, String typeExpression)
Description copied from interface:ColumnEditor
Set the database-specific name of the column's data type. The expression includes the column'stype name
and also any dimensions, lengths, precisions, character sets, etc.- Specified by:
type
in interfaceColumnEditor
- Parameters:
typeName
- the column's type nametypeExpression
- the column's complete type expression- Returns:
- this editor so callers can chain methods together
-
jdbcType
public ColumnEditorImpl jdbcType(int jdbcType)
Description copied from interface:ColumnEditor
Set theJDBC type
of this column.- Specified by:
jdbcType
in interfaceColumnEditor
- Parameters:
jdbcType
-JDBC type
for this column- Returns:
- this editor so callers can chain methods together
-
nativeType
public ColumnEditorImpl nativeType(int nativeType)
Description copied from interface:ColumnEditor
Set the native type for this column . This is database specific.- Specified by:
nativeType
in interfaceColumnEditor
- Returns:
- a type constant for the specific database
-
charsetName
public ColumnEditor charsetName(String charsetName)
Description copied from interface:ColumnEditor
Set the database-specific name of the character set used by this column.- Specified by:
charsetName
in interfaceColumnEditor
- Parameters:
charsetName
- the database-specific character set name; may be null- Returns:
- this editor so callers can chain methods together
-
charsetNameOfTable
public ColumnEditor charsetNameOfTable(String charsetName)
Description copied from interface:ColumnEditor
Set the database-specific name of the character set defined by this column's table.- Specified by:
charsetNameOfTable
in interfaceColumnEditor
- Parameters:
charsetName
- the database-specific character set name; may be null- Returns:
- this editor so callers can chain methods together
-
length
public ColumnEditorImpl length(int length)
Description copied from interface:ColumnEditor
Set the maximum length of this column's values. For numeric columns, this represents the precision.- Specified by:
length
in interfaceColumnEditor
- Parameters:
length
- the column's length- Returns:
- this editor so callers can chain methods together
-
scale
public ColumnEditorImpl scale(Integer scale)
Description copied from interface:ColumnEditor
Set the scale of the column.- Specified by:
scale
in interfaceColumnEditor
- Parameters:
scale
- the scale ornull
to unset- Returns:
- this editor so callers can chain methods together
-
optional
public ColumnEditorImpl optional(boolean optional)
Description copied from interface:ColumnEditor
Set whether the column's values are optional (e.g., can contain nulls).- Specified by:
optional
in interfaceColumnEditor
- Parameters:
optional
-true
if the column's values are optional, orfalse
otherwise- Returns:
- this editor so callers can chain methods together
-
autoIncremented
public ColumnEditorImpl autoIncremented(boolean autoIncremented)
Description copied from interface:ColumnEditor
Set whether the column's values are automatically incremented.- Specified by:
autoIncremented
in interfaceColumnEditor
- Parameters:
autoIncremented
-true
if the column's values are automatically incremented by the database, orfalse
otherwise- Returns:
- this editor so callers can chain methods together
-
generated
public ColumnEditorImpl generated(boolean generated)
Description copied from interface:ColumnEditor
Set whether the column's values are generated by the database.- Specified by:
generated
in interfaceColumnEditor
- Parameters:
generated
-true
if the column's values are generated by the database, orfalse
otherwise- Returns:
- this editor so callers can chain methods together
-
position
public ColumnEditorImpl position(int position)
Description copied from interface:ColumnEditor
Set the position of the column within the table definition.- Specified by:
position
in interfaceColumnEditor
- Parameters:
position
- the new column position- Returns:
- this editor so callers can chain methods together
-
defaultValueExpression
public ColumnEditor defaultValueExpression(String defaultValueExpression)
Description copied from interface:ColumnEditor
Set the default value expression of the column;- Specified by:
defaultValueExpression
in interfaceColumnEditor
- Parameters:
defaultValueExpression
- the default value expression- Returns:
- this editor so callers can chain methods together
-
unsetDefaultValueExpression
public ColumnEditor unsetDefaultValueExpression()
Description copied from interface:ColumnEditor
Unsets the default value expression of the column, reverting the editor to the state where {@link #defaultValueExpression(String))} has never been called- Specified by:
unsetDefaultValueExpression
in interfaceColumnEditor
- Returns:
- this editor so callers can chain methods together
-
enumValues
public ColumnEditor enumValues(List<String> enumValues)
Description copied from interface:ColumnEditor
Set the list of enumeration values.- Specified by:
enumValues
in interfaceColumnEditor
- Parameters:
enumValues
- the enumeration values- Returns:
- this editor so callers can chain methods together
-
comment
public ColumnEditor comment(String comment)
Description copied from interface:ColumnEditor
Set the comment of the column- Specified by:
comment
in interfaceColumnEditor
- Parameters:
comment
- column comment- Returns:
- this editor so callers can chain methods together
-
create
public Column create()
Description copied from interface:ColumnEditor
Obtain an immutable column definition representing the current state of this editor. Typically, an editor is created and used to build a column, and then discarded. However, this editor with its current state can be reused after this method, since the resulting column definition no longer refers to any of the data used in this editor.- Specified by:
create
in interfaceColumnEditor
- Returns:
- the immutable column definition; never null
-
-