Package io.debezium.relational
Interface ColumnEditor
-
- All Known Implementing Classes:
ColumnEditorImpl
@NotThreadSafe public interface ColumnEditor
An editor forColumn
instances.- Author:
- Randall Hauch
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ColumnEditor
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.Column
create()
Obtain an immutable column definition representing the current state of this editor.Object
defaultValue()
Get the default value of the column.ColumnEditor
defaultValue(Object defaultValue)
Set the default value of the column;List<String>
enumValues()
get the enumeration values for the column.ColumnEditor
enumValues(List<String> enumValues)
Set the list of enumeration values.ColumnEditor
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 columnColumnEditor
jdbcType(int jdbcType)
Set theJDBC type
of this column.int
length()
Get the maximum length of this column's values.ColumnEditor
length(int length)
Set the maximum length of this column's values.String
name()
Get the name of the column.ColumnEditor
name(String name)
Set the name of the column.int
nativeType()
Get the internal database-specific type identifier for this column.ColumnEditor
nativeType(int nativeType)
Set the native type for this column .ColumnEditor
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.ColumnEditor
position(int position)
Set the position of the column within the table definition.Optional<Integer>
scale()
Get the scale of the column.ColumnEditor
scale(Integer scale)
Set the scale of the column.ColumnEditor
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
unsetDefaultValue()
Unsets the default value of the column, reverting the editor to the state where {@link #defaultValue(Object))} has never been called
-
-
-
Method Detail
-
name
String name()
Get the name of the column.- Returns:
- the column name; may be null if not set
-
position
int position()
Get the position of the column in the table.- Returns:
- the 1-based position
-
jdbcType
int jdbcType()
Get theJDBC type
for this column- Returns:
- the type constant
-
nativeType
int nativeType()
Get the internal database-specific type identifier for this column.- Returns:
- a type constant for the specific database
-
typeName
String typeName()
Get the database-specific name of the column's data type.- Returns:
- the name of the type; may be null if not set
-
typeExpression
String typeExpression()
Get the database-specific complete expression defining the column's data type, including dimensions, length, precision, character sets, constraints, etc.- Returns:
- the complete type expression
-
charsetName
String charsetName()
Get the database-specific name of the character set used by this column.- 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
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.- Returns:
- the database-specific character set name defined for this column's table, or null if not defined
-
length
int length()
Get the maximum length of this column's values. For numeric columns, this represents the precision.- Returns:
- the length of the column
-
isOptional
boolean isOptional()
Determine whether this column is optional.- Returns:
true
if it is optional, orfalse
otherwise
-
isAutoIncremented
boolean isAutoIncremented()
Determine whether this column's values are automatically incremented by the database.- Returns:
true
if the values are auto-incremented, orfalse
otherwise
-
isGenerated
boolean isGenerated()
Determine whether this column's values are generated by the database.- Returns:
true
if the values are generated, orfalse
otherwise
-
defaultValue
Object defaultValue()
Get the default value of the column.- Returns:
- the default value
-
hasDefaultValue
boolean hasDefaultValue()
Determine whether this column's has a default value set- Returns:
true
if the default value was provided, orfalse
otherwise
-
enumValues
List<String> enumValues()
get the enumeration values for the column.- Returns:
- the list of enumeration values
-
name
ColumnEditor name(String name)
Set the name of the column.- Parameters:
name
- the column name- Returns:
- this editor so callers can chain methods together
-
type
ColumnEditor type(String typeName)
Set the database-specific name of the column's data type.- Parameters:
typeName
- the column's type name- Returns:
- this editor so callers can chain methods together
-
type
ColumnEditor type(String typeName, String typeExpression)
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.- Parameters:
typeName
- the column's type nametypeExpression
- the column's complete type expression- Returns:
- this editor so callers can chain methods together
-
jdbcType
ColumnEditor jdbcType(int jdbcType)
Set theJDBC type
of this column.- Parameters:
jdbcType
-JDBC type
for this column- Returns:
- this editor so callers can chain methods together
-
nativeType
ColumnEditor nativeType(int nativeType)
Set the native type for this column . This is database specific.- Returns:
- a type constant for the specific database
-
charsetName
ColumnEditor charsetName(String charsetName)
Set the database-specific name of the character set used by this column.- Parameters:
charsetName
- the database-specific character set name; may be null- Returns:
- this editor so callers can chain methods together
-
charsetNameOfTable
ColumnEditor charsetNameOfTable(String charsetName)
Set the database-specific name of the character set defined by this column's table.- Parameters:
charsetName
- the database-specific character set name; may be null- Returns:
- this editor so callers can chain methods together
-
length
ColumnEditor length(int length)
Set the maximum length of this column's values. For numeric columns, this represents the precision.- Parameters:
length
- the column's length- Returns:
- this editor so callers can chain methods together
-
scale
ColumnEditor scale(Integer scale)
Set the scale of the column.- Parameters:
scale
- the scale ornull
to unset- Returns:
- this editor so callers can chain methods together
-
optional
ColumnEditor optional(boolean optional)
Set whether the column's values are optional (e.g., can contain nulls).- Parameters:
optional
-true
if the column's values are optional, orfalse
otherwise- Returns:
- this editor so callers can chain methods together
-
autoIncremented
ColumnEditor autoIncremented(boolean autoIncremented)
Set whether the column's values are automatically incremented.- 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
ColumnEditor generated(boolean generated)
Set whether the column's values are generated by the database.- 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
ColumnEditor position(int position)
Set the position of the column within the table definition.- Parameters:
position
- the new column position- Returns:
- this editor so callers can chain methods together
-
defaultValue
ColumnEditor defaultValue(Object defaultValue)
Set the default value of the column;- Parameters:
defaultValue
- the default value- Returns:
- this editor so callers can chain methods together
-
enumValues
ColumnEditor enumValues(List<String> enumValues)
Set the list of enumeration values.- Parameters:
enumValues
- the enumeration values- Returns:
- this editor so callers can chain methods together
-
unsetDefaultValue
ColumnEditor unsetDefaultValue()
Unsets the default value of the column, reverting the editor to the state where {@link #defaultValue(Object))} has never been called- Returns:
- this editor so callers can chain methods together
-
create
Column create()
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.- Returns:
- the immutable column definition; never null
-
-