Package dev.frostlake.types
Class NumericType
java.lang.Object
dev.frostlake.types.DataType
dev.frostlake.types.NumericType
- All Implemented Interfaces:
Serializable
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic NumericTypestatic NumericTypestatic NumericTypestatic NumericTypestatic NumericTypestatic NumericTypestatic NumericTypestatic NumericType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionformatValue(Object value) getCommonType(DataType other) intintgetScale()intgetSize()static booleanisApproximate(DataType type) Whether a type is one of the APPROXIMATE numeric spellings, which carry no precision and scale.static booleanisApproximateName(String name) Whether a type NAME is one of the approximate spellings — for a caller that has the name and not the type, such as a driver reading column metadata off the wire.booleanisCompatible(DataType other) parseValue(String value)
-
Field Details
-
INTEGER
-
BIGINT
-
SMALLINT
-
TINYINT
-
NUMBER
-
DECIMAL
-
FLOAT
-
DOUBLE
-
-
Constructor Details
-
NumericType
-
-
Method Details
-
getPrecision
public int getPrecision() -
getScale
public int getScale() -
parseValue
- Specified by:
parseValuein classDataType
-
formatValue
- Specified by:
formatValuein classDataType
-
isCompatible
- Specified by:
isCompatiblein classDataType
-
getCommonType
- Specified by:
getCommonTypein classDataType
-
getSize
public int getSize() -
isApproximate
Whether a type is one of the APPROXIMATE numeric spellings, which carry no precision and scale.Live-verified on every metadata surface: a FLOAT column is
{"type":"REAL"}in SHOW COLUMNS with no numbers beside it, and leaves NUMERIC_PRECISION and NUMERIC_SCALE NULL in INFORMATION_SCHEMA. The nominal pair these constants carry is an engine-internal placeholder and must not be published to a client as though it were declared.- Parameters:
type- the type to test- Returns:
- true for FLOAT and its aliases
-
isApproximateName
Whether a type NAME is one of the approximate spellings — for a caller that has the name and not the type, such as a driver reading column metadata off the wire.- Parameters:
name- the declared type's name- Returns:
- true for FLOAT and its aliases
-