public class SpecialValueDecimal extends Object implements Serializable
BigDecimal
type that adds support for new features
like special values handling - NaN, infinity;Modifier and Type | Class and Description |
---|---|
private static class |
SpecialValueDecimal.SpecialValue
Special values for floating-point and numeric types
|
Modifier and Type | Field and Description |
---|---|
private BigDecimal |
decimalValue |
static SpecialValueDecimal |
NEGATIVE_INF |
static SpecialValueDecimal |
NOT_A_NUMBER |
static SpecialValueDecimal |
POSITIVE_INF |
private static String |
PRECISION_PARAMETER_KEY
Used as a schema parameter by the Avro serializer for creating a corresponding Avro schema with the correct
precision.
|
private static long |
serialVersionUID |
private SpecialValueDecimal.SpecialValue |
specialValue |
static SpecialValueDecimal |
ZERO |
Modifier | Constructor and Description |
---|---|
|
SpecialValueDecimal(BigDecimal value) |
private |
SpecialValueDecimal(SpecialValueDecimal.SpecialValue specialValue) |
Modifier and Type | Method and Description |
---|---|
static org.apache.kafka.connect.data.SchemaBuilder |
builder(JdbcValueConverters.DecimalMode mode,
int precision,
int scale)
Returns a
SchemaBuilder for a decimal number depending on JdbcValueConverters.DecimalMode . |
boolean |
equals(Object obj) |
static Object |
fromLogical(SpecialValueDecimal value,
JdbcValueConverters.DecimalMode mode,
String columnName) |
Optional<BigDecimal> |
getDecimalValue() |
int |
hashCode() |
double |
toDouble() |
String |
toString()
Converts a value from its logical format (BigDecimal/special) to its string representation
|
static SpecialValueDecimal |
valueOf(String decimal)
Factory method for creating instances from numbers in string format
|
private static final long serialVersionUID
private static final String PRECISION_PARAMETER_KEY
AvroData#CONNECT_AVRO_DECIMAL_PRECISION_PROP}.
,
Constant Field Valuespublic static SpecialValueDecimal ZERO
public static SpecialValueDecimal NOT_A_NUMBER
public static SpecialValueDecimal POSITIVE_INF
public static SpecialValueDecimal NEGATIVE_INF
private final BigDecimal decimalValue
private final SpecialValueDecimal.SpecialValue specialValue
public SpecialValueDecimal(BigDecimal value)
private SpecialValueDecimal(SpecialValueDecimal.SpecialValue specialValue)
public Optional<BigDecimal> getDecimalValue()
public static SpecialValueDecimal valueOf(String decimal)
decimal
- a string containing valid decimal numberSpecialValueDecimal
containing converted BigDecimal
public double toDouble()
public String toString()
public static org.apache.kafka.connect.data.SchemaBuilder builder(JdbcValueConverters.DecimalMode mode, int precision, int scale)
SchemaBuilder
for a decimal number depending on JdbcValueConverters.DecimalMode
. You
can use the resulting schema builder to set additional schema settings such as required/optional, default value,
and documentation.mode
- the mode in which the number should be encodedprecision
- the precision of the decimalscale
- scale of the decimalpublic static Object fromLogical(SpecialValueDecimal value, JdbcValueConverters.DecimalMode mode, String columnName)
Copyright © 2020 JBoss by Red Hat. All rights reserved.