public class Decimal
extends java.lang.Object
An arbitrary-precision signed decimal number. The value is unscaled * 10 ^ -scale where:
Decimal does not provide a fixed schema because it is parameterized by the scale, which is fixed on the schema rather than being part of the value.
The underlying representation of this type is bytes containing a two's complement integer
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
LOGICAL_NAME |
static java.lang.String |
SCALE_FIELD |
Constructor and Description |
---|
Decimal() |
Modifier and Type | Method and Description |
---|---|
static SchemaBuilder |
builder(int scale)
Returns a SchemaBuilder for a Decimal with the given scale factor.
|
static byte[] |
fromLogical(Schema schema,
java.math.BigDecimal value)
Convert a value from its logical format (BigDecimal) to it's encoded format.
|
static Schema |
schema(int scale) |
static java.math.BigDecimal |
toLogical(Schema schema,
byte[] value) |
public static final java.lang.String LOGICAL_NAME
public static final java.lang.String SCALE_FIELD
public static SchemaBuilder builder(int scale)
scale
- the scale factor to apply to unscaled valuespublic static Schema schema(int scale)
public static byte[] fromLogical(Schema schema, java.math.BigDecimal value)
value
- the logical valuepublic static java.math.BigDecimal toLogical(Schema schema, byte[] value)