public class Decimal
extends java.lang.Object
Types.DecimalType
value in Gravitino.
For Decimal, we expect the precision is equal to or larger than the scale, however, in BigDecimal
, the digit count starts from the leftmost nonzero digit of the exact result. For
example, the precision of 0.01 equals to 1 based on the definition, but the scale is 2. The
expected precision should be 2.
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
static Decimal |
of(java.math.BigDecimal value)
Creates a decimal value with the given value.
|
static Decimal |
of(java.math.BigDecimal value,
int precision,
int scale)
Creates a decimal value with the given value, precision and scale.
|
static Decimal |
of(java.lang.String value)
Creates a decimal value with the given value.
|
static Decimal |
of(java.lang.String value,
int precision,
int scale)
Creates a decimal value with the given value, precision and scale.
|
int |
precision() |
int |
scale() |
java.lang.String |
toString() |
java.math.BigDecimal |
value() |
public static Decimal of(java.math.BigDecimal value, int precision, int scale)
value
- The value of the decimal.precision
- The precision of the decimal.scale
- The scale of the decimal.Decimal
instance.public static Decimal of(java.math.BigDecimal value)
value
- The value of the decimal.Decimal
instance.public static Decimal of(java.lang.String value)
value
- The value of the decimal.Decimal
instance.public static Decimal of(java.lang.String value, int precision, int scale)
value
- The value of the decimal.precision
- The precision of the decimal.scale
- The scale of the decimal.Decimal
instance.public java.math.BigDecimal value()
public int precision()
public int scale()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object