public final class DecimalType extends SimpleType
Decimal
.Modifier and Type | Field and Description |
---|---|
static RoundingMode |
DEFAULT_ROUNDING_MODE
Default rounding mode
|
static int |
DEFAULT_SCALE
Default scale
|
static int |
MAX_SCALE
Maximal possible scale
|
static int |
MIN_SCALE
Minimal possible scale
|
static String |
NAME
Name of the type.
|
BINARY, BOOLEAN, DATE, DECIMAL, ENUMERATION, INTEGER, LOCAL_DATE, NULL, OBJECT, PROPERTY, PROPERTY_PATH, RECORD, STRING, VOID
Constructor and Description |
---|
DecimalType()
Creates new instance with default scale and rounding mode.
|
DecimalType(int scale)
Creates new instance with default rounding mode.
|
DecimalType(int scale,
RoundingMode roundingMode)
Creates new instance.
|
Modifier and Type | Method and Description |
---|---|
<T,E extends Throwable> |
accept(TypeVisitor<T,E> visitor)
Accepts type visitor.
|
RoundingMode |
getRoundingMode()
Returns the rounding mode.
|
int |
getScale()
Returns the scale.
|
Type |
getSupertype()
Returns a direct supertype to this type (or null for "Object" type).
|
Object |
performConversion(Object object)
Performs a type conversion that should be performed when an object is
assigned to a variable of this type (possibly none).
|
String |
toString()
Returns the string representation of this type in the format
Decimal(#scale, #roundingMode) . |
static boolean |
validScale(int scale)
Returns true if given scale is valid.
|
equals, forJavaClass, forName, getJavaClass, getName, getSimpleTypes, hashCode, hasIntersectionType
assignableTo, findCommonSubtype, findCommonSupertype, getFreeTypes, hasFreeTypes, isCollection, matchesSubtype, matchesSupertype, substituteFreeTypes
public static final String NAME
public static final int MIN_SCALE
public static final int MAX_SCALE
public static final int DEFAULT_SCALE
public static final RoundingMode DEFAULT_ROUNDING_MODE
public DecimalType()
public DecimalType(int scale)
scale
- IllegalArgumentException
- if scale
is not in the range (MIN_SCALE
,
MAX_SCALE
)public DecimalType(int scale, RoundingMode roundingMode)
scale
- roundingMode
- NullPointerException
- if roundingMode
is nullIllegalArgumentException
- if scale
is not in the range (MIN_SCALE
,
MAX_SCALE
)public Type getSupertype()
Type
public int getScale()
public RoundingMode getRoundingMode()
public static boolean validScale(int scale)
scale
- public String toString()
Decimal(#scale, #roundingMode)
.toString
in class SimpleType
SimpleType.toString()
public <T,E extends Throwable> T accept(TypeVisitor<T,E> visitor) throws E extends Throwable
Type
T
- visitor return typevisitor
- visitor to visitE
E extends Throwable
public Object performConversion(Object object)
Type
performConversion
in interface Type
performConversion
in class AbstractType
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.