public class TruncateStrings extends Object implements ColumnMapper
ColumnMapper implementation that ensures that string values longer than a specified length will be truncated.| Modifier and Type | Class and Description |
|---|---|
protected static class |
TruncateStrings.TruncatingValueConverter |
| Modifier and Type | Field and Description |
|---|---|
private TruncateStrings.TruncatingValueConverter |
converter |
| Constructor and Description |
|---|
TruncateStrings(int maxLength)
Create a
ColumnMapper that truncates string values to a maximum length. |
| Modifier and Type | Method and Description |
|---|---|
void |
alterFieldSchema(Column column,
org.apache.kafka.connect.data.SchemaBuilder schemaBuilder)
Optionally annotate the schema with properties to better capture the mapping behavior.
|
ValueConverter |
create(Column column)
Create for the given column a function that maps values.
|
protected boolean |
isTruncationPossible(Column column) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinitializeprivate final TruncateStrings.TruncatingValueConverter converter
public TruncateStrings(int maxLength)
ColumnMapper that truncates string values to a maximum length.maxLength - the maximum number of characters allowed in valuesIllegalArgumentException - if the maxLength is not positivepublic ValueConverter create(Column column)
ColumnMappercreate in interface ColumnMappercolumn - the column description; never nullpublic void alterFieldSchema(Column column, org.apache.kafka.connect.data.SchemaBuilder schemaBuilder)
ColumnMapperalterFieldSchema in interface ColumnMappercolumn - the column definition; never nullschemaBuilder - the builder for the Field's schema; never nullprotected boolean isTruncationPossible(Column column)
Copyright © 2021 JBoss by Red Hat. All rights reserved.