@Immutable public class MySqlDefaultValueConverter extends Object
AbstractRowsEventDataDeserializer| Modifier and Type | Field and Description |
|---|---|
private MySqlValueConverters |
converters |
private static String |
EPOCH_DATE |
private static Pattern |
EPOCH_EQUIVALENT_DATE |
private static Pattern |
EPOCH_EQUIVALENT_TIMESTAMP |
private static String |
EPOCH_TIMESTAMP |
| Constructor and Description |
|---|
MySqlDefaultValueConverter(MySqlValueConverters converters) |
| Modifier and Type | Method and Description |
|---|---|
private String |
cleanTimestamp(String s)
Clean input timestamp to yyyy-mm-dd hh:mm:ss[.fffffffff] format
|
Object |
convert(Column column,
String value)
Converts a default value from the expected format to a logical object acceptable by the main JDBC
converter.
|
private Object |
convertToBit(String value) |
private Object |
convertToBits(Column column,
String value)
Converts a string object for an expected JDBC type of
Types.BIT. |
private Object |
convertToBits(String value) |
private Object |
convertToBoolean(String value)
Converts a string object for an expected JDBC type of
Types.BOOLEAN. |
private Object |
convertToDecimal(Column column,
String value)
Converts a string object for an expected JDBC type of
Types.DECIMAL. |
private Object |
convertToDouble(String value)
Converts a string object for an expected JDBC type of
Types.DOUBLE. |
private Object |
convertToDuration(Column column,
String value)
Converts a string object for an object type of
Duration. |
private Object |
convertToLocalDate(Column column,
String value)
Converts a string object for an object type of
LocalDate. |
private Object |
convertToLocalDateTime(Column column,
String value)
Converts a string object for an object type of
LocalDateTime. |
private Object |
convertToTimestamp(Column column,
String value)
Converts a string object for an object type of
Timestamp. |
private String |
replaceFirstNonNumericSubstring(String s,
int startIndex,
char c)
Replace the first non-numeric substring
|
ColumnEditor |
setColumnDefaultValue(ColumnEditor columnEditor) |
private DateTimeFormatter |
timestampFormat(int length) |
private static final Pattern EPOCH_EQUIVALENT_TIMESTAMP
private static final Pattern EPOCH_EQUIVALENT_DATE
private static final String EPOCH_TIMESTAMP
private static final String EPOCH_DATE
private final MySqlValueConverters converters
public MySqlDefaultValueConverter(MySqlValueConverters converters)
public Object convert(Column column, String value)
column - column definitionvalue - string formatted default valueprivate Object convertToLocalDate(Column column, String value)
LocalDate.
If the column definition allows null and default value is 0000-00-00, we need return null;
else 0000-00-00 will be replaced with 1970-01-01;column - the column definition describing the data value; never nullvalue - the string object to be converted into a LocalDate type;private Object convertToLocalDateTime(Column column, String value)
LocalDateTime.
If the column definition allows null and default value is 0000-00-00 00:00:00, we need return null,
else 0000-00-00 00:00:00 will be replaced with 1970-01-01 00:00:00;column - the column definition describing the data value; never nullvalue - the string object to be converted into a LocalDateTime type;private Object convertToTimestamp(Column column, String value)
Timestamp.
If the column definition allows null and default value is 0000-00-00 00:00:00, we need return null,
else 0000-00-00 00:00:00 will be replaced with 1970-01-01 00:00:00;column - the column definition describing the data value; never nullvalue - the string object to be converted into a Timestamp type;private Object convertToDuration(Column column, String value)
Duration.column - the column definition describing the data value; never nullvalue - the string object to be converted into a Duration type;private Object convertToDouble(String value)
Types.DOUBLE.value - the string object to be converted into a Types.DOUBLE type;private Object convertToDecimal(Column column, String value)
Types.DECIMAL.column - the column definition describing the data value; never nullvalue - the string object to be converted into a Types.DECIMAL type;private Object convertToBits(Column column, String value)
Types.BIT.column - the column definition describing the data value; never nullvalue - the string object to be converted into a Types.BIT type;private Object convertToBoolean(String value)
Types.BOOLEAN.value - the string object to be converted into a Types.BOOLEAN type;private DateTimeFormatter timestampFormat(int length)
private String cleanTimestamp(String s)
s - input timestampprivate String replaceFirstNonNumericSubstring(String s, int startIndex, char c)
s - the original stringstartIndex - the beginning index, inclusivec - the new characterpublic ColumnEditor setColumnDefaultValue(ColumnEditor columnEditor)
Copyright © 2020 JBoss by Red Hat. All rights reserved.