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 booleanautoIncrementedprivate StringcharsetNameprivate Stringcommentprivate StringdefaultValueExpressionprivate List<String>enumValuesprivate booleangeneratedprivate booleanhasDefaultValueprivate intjdbcTypeprivate intlengthprivate Stringnameprivate intnativeTypeprivate booleanoptionalprivate intpositionprivate Integerscaleprivate StringtableCharsetNameprivate StringtypeExpressionprivate StringtypeName
-
Constructor Summary
Constructors Modifier Constructor Description protectedColumnEditorImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ColumnEditorImplautoIncremented(boolean autoIncremented)Set whether the column's values are automatically incremented.StringcharsetName()Get the database-specific name of the character set used by this column.ColumnEditorcharsetName(String charsetName)Set the database-specific name of the character set used by this column.StringcharsetNameOfTable()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.ColumnEditorcharsetNameOfTable(String charsetName)Set the database-specific name of the character set defined by this column's table.Stringcomment()Get the comment of the column.ColumnEditorcomment(String comment)Set the comment of the columnColumncreate()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.ColumnEditordefaultValueExpression(String defaultValueExpression)Set the default value expression of the column;List<String>enumValues()get the enumeration values for the column.ColumnEditorenumValues(List<String> enumValues)Set the list of enumeration values.ColumnEditorImplgenerated(boolean generated)Set whether the column's values are generated by the database.booleanhasDefaultValue()Determine whether this column's has a default value setbooleanisAutoIncremented()Determine whether this column's values are automatically incremented by the database.booleanisGenerated()Determine whether this column's values are generated by the database.booleanisOptional()Determine whether this column is optional.intjdbcType()Get theJDBC typefor this columnColumnEditorImpljdbcType(int jdbcType)Set theJDBC typeof this column.intlength()Get the maximum length of this column's values.ColumnEditorImpllength(int length)Set the maximum length of this column's values.Stringname()Get the name of the column.ColumnEditorImplname(String name)Set the name of the column.intnativeType()Get the internal database-specific type identifier for this column.ColumnEditorImplnativeType(int nativeType)Set the native type for this column .ColumnEditorImploptional(boolean optional)Set whether the column's values are optional (e.g., can contain nulls).intposition()Get the position of the column in the table.ColumnEditorImplposition(int position)Set the position of the column within the table definition.Optional<Integer>scale()Get the scale of the column.ColumnEditorImplscale(Integer scale)Set the scale of the column.StringtoString()ColumnEditorImpltype(String typeName)Set the database-specific name of the column's data type.ColumnEditortype(String typeName, String typeExpression)Set the database-specific name of the column's data type.StringtypeExpression()Get the database-specific complete expression defining the column's data type, including dimensions, length, precision, character sets, constraints, etc.StringtypeName()Get the database-specific name of the column's data type.ColumnEditorunsetDefaultValueExpression()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:ColumnEditorGet the name of the column.- Specified by:
namein interfaceColumnEditor- Returns:
- the column name; may be null if not set
-
typeName
public String typeName()
Description copied from interface:ColumnEditorGet the database-specific name of the column's data type.- Specified by:
typeNamein interfaceColumnEditor- Returns:
- the name of the type; may be null if not set
-
typeExpression
public String typeExpression()
Description copied from interface:ColumnEditorGet the database-specific complete expression defining the column's data type, including dimensions, length, precision, character sets, constraints, etc.- Specified by:
typeExpressionin interfaceColumnEditor- Returns:
- the complete type expression
-
jdbcType
public int jdbcType()
Description copied from interface:ColumnEditorGet theJDBC typefor this column- Specified by:
jdbcTypein interfaceColumnEditor- Returns:
- the type constant
-
nativeType
public int nativeType()
Description copied from interface:ColumnEditorGet the internal database-specific type identifier for this column.- Specified by:
nativeTypein interfaceColumnEditor- Returns:
- a type constant for the specific database
-
charsetName
public String charsetName()
Description copied from interface:ColumnEditorGet the database-specific name of the character set used by this column.- Specified by:
charsetNamein 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:ColumnEditorGet 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:
charsetNameOfTablein 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:ColumnEditorGet the maximum length of this column's values. For numeric columns, this represents the precision.- Specified by:
lengthin interfaceColumnEditor- Returns:
- the length of the column
-
scale
public Optional<Integer> scale()
Description copied from interface:ColumnEditorGet the scale of the column.- Specified by:
scalein interfaceColumnEditor- Returns:
- the scale if present
-
position
public int position()
Description copied from interface:ColumnEditorGet the position of the column in the table.- Specified by:
positionin interfaceColumnEditor- Returns:
- the 1-based position
-
isOptional
public boolean isOptional()
Description copied from interface:ColumnEditorDetermine whether this column is optional.- Specified by:
isOptionalin interfaceColumnEditor- Returns:
trueif it is optional, orfalseotherwise
-
isAutoIncremented
public boolean isAutoIncremented()
Description copied from interface:ColumnEditorDetermine whether this column's values are automatically incremented by the database.- Specified by:
isAutoIncrementedin interfaceColumnEditor- Returns:
trueif the values are auto-incremented, orfalseotherwise
-
isGenerated
public boolean isGenerated()
Description copied from interface:ColumnEditorDetermine whether this column's values are generated by the database.- Specified by:
isGeneratedin interfaceColumnEditor- Returns:
trueif the values are generated, orfalseotherwise
-
defaultValueExpression
public Optional<String> defaultValueExpression()
Description copied from interface:ColumnEditorGet the database-specific complete expression defining the column's default value.- Specified by:
defaultValueExpressionin interfaceColumnEditor- Returns:
- the complete type expression
-
hasDefaultValue
public boolean hasDefaultValue()
Description copied from interface:ColumnEditorDetermine whether this column's has a default value set- Specified by:
hasDefaultValuein interfaceColumnEditor- Returns:
trueif the default value was provided, orfalseotherwise
-
comment
public String comment()
Description copied from interface:ColumnEditorGet the comment of the column.- Specified by:
commentin interfaceColumnEditor- Returns:
- the column comment; may be null if not set
-
name
public ColumnEditorImpl name(String name)
Description copied from interface:ColumnEditorSet the name of the column.- Specified by:
namein interfaceColumnEditor- Parameters:
name- the column name- Returns:
- this editor so callers can chain methods together
-
enumValues
public List<String> enumValues()
Description copied from interface:ColumnEditorget the enumeration values for the column.- Specified by:
enumValuesin interfaceColumnEditor- Returns:
- the list of enumeration values
-
type
public ColumnEditorImpl type(String typeName)
Description copied from interface:ColumnEditorSet the database-specific name of the column's data type.- Specified by:
typein 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:ColumnEditorSet the database-specific name of the column's data type. The expression includes the column'stype nameand also any dimensions, lengths, precisions, character sets, etc.- Specified by:
typein 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:ColumnEditorSet theJDBC typeof this column.- Specified by:
jdbcTypein interfaceColumnEditor- Parameters:
jdbcType-JDBC typefor this column- Returns:
- this editor so callers can chain methods together
-
nativeType
public ColumnEditorImpl nativeType(int nativeType)
Description copied from interface:ColumnEditorSet the native type for this column . This is database specific.- Specified by:
nativeTypein interfaceColumnEditor- Returns:
- a type constant for the specific database
-
charsetName
public ColumnEditor charsetName(String charsetName)
Description copied from interface:ColumnEditorSet the database-specific name of the character set used by this column.- Specified by:
charsetNamein 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:ColumnEditorSet the database-specific name of the character set defined by this column's table.- Specified by:
charsetNameOfTablein 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:ColumnEditorSet the maximum length of this column's values. For numeric columns, this represents the precision.- Specified by:
lengthin 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:ColumnEditorSet the scale of the column.- Specified by:
scalein interfaceColumnEditor- Parameters:
scale- the scale ornullto unset- Returns:
- this editor so callers can chain methods together
-
optional
public ColumnEditorImpl optional(boolean optional)
Description copied from interface:ColumnEditorSet whether the column's values are optional (e.g., can contain nulls).- Specified by:
optionalin interfaceColumnEditor- Parameters:
optional-trueif the column's values are optional, orfalseotherwise- Returns:
- this editor so callers can chain methods together
-
autoIncremented
public ColumnEditorImpl autoIncremented(boolean autoIncremented)
Description copied from interface:ColumnEditorSet whether the column's values are automatically incremented.- Specified by:
autoIncrementedin interfaceColumnEditor- Parameters:
autoIncremented-trueif the column's values are automatically incremented by the database, orfalseotherwise- Returns:
- this editor so callers can chain methods together
-
generated
public ColumnEditorImpl generated(boolean generated)
Description copied from interface:ColumnEditorSet whether the column's values are generated by the database.- Specified by:
generatedin interfaceColumnEditor- Parameters:
generated-trueif the column's values are generated by the database, orfalseotherwise- Returns:
- this editor so callers can chain methods together
-
position
public ColumnEditorImpl position(int position)
Description copied from interface:ColumnEditorSet the position of the column within the table definition.- Specified by:
positionin 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:ColumnEditorSet the default value expression of the column;- Specified by:
defaultValueExpressionin interfaceColumnEditor- Parameters:
defaultValueExpression- the default value expression- Returns:
- this editor so callers can chain methods together
-
unsetDefaultValueExpression
public ColumnEditor unsetDefaultValueExpression()
Description copied from interface:ColumnEditorUnsets the default value expression of the column, reverting the editor to the state where {@link #defaultValueExpression(String))} has never been called- Specified by:
unsetDefaultValueExpressionin interfaceColumnEditor- Returns:
- this editor so callers can chain methods together
-
enumValues
public ColumnEditor enumValues(List<String> enumValues)
Description copied from interface:ColumnEditorSet the list of enumeration values.- Specified by:
enumValuesin 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:ColumnEditorSet the comment of the column- Specified by:
commentin interfaceColumnEditor- Parameters:
comment- column comment- Returns:
- this editor so callers can chain methods together
-
create
public Column create()
Description copied from interface:ColumnEditorObtain 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:
createin interfaceColumnEditor- Returns:
- the immutable column definition; never null
-
-