Package io.debezium.relational.mapping
Class TruncateStrings
java.lang.Object
io.debezium.relational.mapping.TruncateStrings
- All Implemented Interfaces:
ColumnMapper
A
ColumnMapper
implementation that ensures that string values longer than a specified length will be truncated.- Author:
- Randall Hauch
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static final class
-
Field Summary
-
Constructor Summary
ConstructorDescriptionTruncateStrings
(int maxLength) Create aColumnMapper
that truncates string values to a maximum length. -
Method Summary
Modifier and TypeMethodDescriptionvoid
alterFieldSchema
(Column column, org.apache.kafka.connect.data.SchemaBuilder schemaBuilder) Optionally annotate the schema with properties to better capture the mapping behavior.Create for the given column a function that maps values.protected boolean
isTruncationPossible
(Column column) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.debezium.relational.mapping.ColumnMapper
initialize
-
Field Details
-
converter
-
-
Constructor Details
-
TruncateStrings
public TruncateStrings(int maxLength) Create aColumnMapper
that truncates string values to a maximum length.- Parameters:
maxLength
- the maximum number of characters allowed in values- Throws:
IllegalArgumentException
- if themaxLength
is not positive
-
-
Method Details
-
create
Description copied from interface:ColumnMapper
Create for the given column a function that maps values.- Specified by:
create
in interfaceColumnMapper
- Parameters:
column
- the column description; never null- Returns:
- the function that converts the value; may be null
-
alterFieldSchema
public void alterFieldSchema(Column column, org.apache.kafka.connect.data.SchemaBuilder schemaBuilder) Description copied from interface:ColumnMapper
Optionally annotate the schema with properties to better capture the mapping behavior.- Specified by:
alterFieldSchema
in interfaceColumnMapper
- Parameters:
column
- the column definition; never nullschemaBuilder
- the builder for theField
's schema; never null
-
isTruncationPossible
-