Package io.debezium.data
Class SpecialValueDecimal
java.lang.Object
io.debezium.data.SpecialValueDecimal
- All Implemented Interfaces:
ValueWrapper<BigDecimal>,Serializable
Extension of plain a
BigDecimal type that adds support for new features
like special values handling - NaN, infinity;- Author:
- Jiri Pechanec
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enumSpecial values for floating-point and numeric types -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BigDecimalstatic SpecialValueDecimalstatic SpecialValueDecimalstatic SpecialValueDecimalprivate static final StringUsed as a schema parameter by the Avro serializer for creating a corresponding Avro schema with the correct precision.private static final longprivate final SpecialValueDecimal.SpecialValuestatic SpecialValueDecimal -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateSpecialValueDecimal(SpecialValueDecimal.SpecialValue specialValue) SpecialValueDecimal(BigDecimal value) -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.kafka.connect.data.SchemaBuilderbuilder(JdbcValueConverters.DecimalMode mode, int precision, int scale) Returns aSchemaBuilderfor a decimal number depending onJdbcValueConverters.DecimalMode.booleanstatic ObjectfromLogical(SpecialValueDecimal value, JdbcValueConverters.DecimalMode mode, String columnName) inthashCode()doubletoDouble()toString()Converts a value from its logical format (BigDecimal/special) to its string representationstatic SpecialValueDecimalFactory method for creating instances from numbers in string format
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
PRECISION_PARAMETER_KEY
Used as a schema parameter by the Avro serializer for creating a corresponding Avro schema with the correct precision.- See Also:
-
ZERO
-
NOT_A_NUMBER
-
POSITIVE_INF
-
NEGATIVE_INF
-
decimalValue
-
specialValue
-
-
Constructor Details
-
SpecialValueDecimal
-
SpecialValueDecimal
-
-
Method Details
-
getDecimalValue
- Returns:
- the plain decimal value if available
-
valueOf
Factory method for creating instances from numbers in string format- Parameters:
decimal- a string containing valid decimal number- Returns:
SpecialValueDecimalcontaining convertedBigDecimal
-
toDouble
public double toDouble()- Returns:
- value converted into double including special values
-
toString
Converts a value from its logical format (BigDecimal/special) to its string representation -
hashCode
public int hashCode() -
equals
-
builder
public static org.apache.kafka.connect.data.SchemaBuilder builder(JdbcValueConverters.DecimalMode mode, int precision, int scale) Returns aSchemaBuilderfor a decimal number depending onJdbcValueConverters.DecimalMode. You can use the resulting schema builder to set additional schema settings such as required/optional, default value, and documentation.- Parameters:
mode- the mode in which the number should be encodedprecision- the precision of the decimalscale- scale of the decimal- Returns:
- the schema builder
-
fromLogical
public static Object fromLogical(SpecialValueDecimal value, JdbcValueConverters.DecimalMode mode, String columnName) -
getWrappedValue
- Specified by:
getWrappedValuein interfaceValueWrapper<BigDecimal>
-