public class Decimal extends Object
An arbitrary-precision signed decimal number. The value is unscaled * 10 ^ -scale where:
- unscaled is an integer
- scale is an integer representing how many digits the decimal point should be shifted on the unscaled value
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
Constructors Constructor Description
Modifier and Type Method Description
(int scale)Returns a SchemaBuilder for a Decimal with the given scale factor.
Schema schema, BigDecimal value)(Convert a value from its logical format (BigDecimal) to it's encoded format.
Schema schema, byte value)(
builderpublic static SchemaBuilder builder(int scale)Returns a SchemaBuilder for a Decimal with the given scale factor. By returning a SchemaBuilder you can override additional schema settings such as required/optional, default value, and documentation.
scale- the scale factor to apply to unscaled values
- a SchemaBuilder
schemapublic static Schema schema(int scale)
fromLogicalConvert a value from its logical format (BigDecimal) to it's encoded format.
value- the logical value
- the encoded value