Package deltix.qsrv.hf.pub.md
Class DataType
- java.lang.Object
-
- deltix.qsrv.hf.pub.md.DataType
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
- Direct Known Subclasses:
ArrayDataType
,BinaryDataType
,BooleanDataType
,CharDataType
,ClassDataType
,DateTimeDataType
,EnumDataType
,FloatDataType
,IntegerDataType
,QueryDataType
,TimeOfDayDataType
,VarcharDataType
public abstract class DataType extends java.lang.Object implements java.io.Serializable, java.lang.Cloneable
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DataType.ConversionType
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
encoding
static int
T_ARRAY_TYPE
static int
T_BINARY_TYPE
static int
T_BOOLEAN_TYPE
static int
T_CHAR_TYPE
static int
T_DATE_TIME_TYPE
static int
T_DOUBLE_TYPE
static int
T_ENUM_TYPE
static int
T_FLOAT_TYPE
static int
T_INTEGER_TYPE
static int
T_OBJECT_TYPE
static int
T_STRING_TYPE
static int
T_TIME_OF_DAY_TYPE
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
assertValid(java.lang.Object obj)
Checks a Boxed value against constraints, if any.protected abstract void
assertValidImpl(java.lang.Object obj)
Checks a non-null Boxed value against constraints, if any.DataType
clone()
abstract java.lang.String
getBaseName()
abstract int
getCode()
java.lang.String
getEncoding()
abstract DataType.ConversionType
isConvertible(DataType to)
boolean
isNullable()
boolean
isPrimitive()
DataType
nullableInstance(boolean nullable)
protected java.lang.IllegalArgumentException
outOfRange(java.lang.Object obj, java.lang.Object min, java.lang.Object max)
Helper method to construct an exception thrown when a value passed totoString(java.lang.Object)
orassertValid(java.lang.Object)
is out of range.java.lang.Object
parse(java.lang.CharSequence value)
Convert the String representation to Boxed, also validating it against constraints, if any.static boolean
parseBoolean(java.lang.String s)
static byte
parseByte(java.lang.String s)
static long
parseDate(java.lang.String s)
static double
parseDouble(java.lang.String s)
void
parseEncoding(java.lang.String encoding)
static float
parseFloat(java.lang.String s)
static int
parseInt(java.lang.String s)
static long
parseLong(java.lang.String s)
static short
parseShort(java.lang.String s)
protected void
readFields(java.io.DataInputStream in, ClassDescriptor.TypeResolver resolver)
static DataType
readFrom(java.io.DataInputStream in, ClassDescriptor.TypeResolver resolver)
void
setNullable(boolean nullable)
protected abstract java.lang.Object
toBoxedImpl(java.lang.CharSequence text)
Parse non-null text and return an object without checking constraints.java.lang.String
toString(java.lang.Object obj)
Convert the Boxed representation to String, also validating it against constraints, if any.protected abstract java.lang.String
toStringImpl(java.lang.Object obj)
Converts a non-null, constraint-compliant Boxed value to String.protected java.lang.IllegalArgumentException
unsupportedType(java.lang.Object obj)
Helper method to construct an exception thrown when object type passed totoString(java.lang.Object)
orassertValid(java.lang.Object)
is completely illegal.void
writeTo(java.io.DataOutputStream out)
-
-
-
Field Detail
-
T_BINARY_TYPE
public static final int T_BINARY_TYPE
- See Also:
- Constant Field Values
-
T_CHAR_TYPE
public static final int T_CHAR_TYPE
- See Also:
- Constant Field Values
-
T_STRING_TYPE
public static final int T_STRING_TYPE
- See Also:
- Constant Field Values
-
T_DATE_TIME_TYPE
public static final int T_DATE_TIME_TYPE
- See Also:
- Constant Field Values
-
T_BOOLEAN_TYPE
public static final int T_BOOLEAN_TYPE
- See Also:
- Constant Field Values
-
T_TIME_OF_DAY_TYPE
public static final int T_TIME_OF_DAY_TYPE
- See Also:
- Constant Field Values
-
T_INTEGER_TYPE
public static final int T_INTEGER_TYPE
- See Also:
- Constant Field Values
-
T_FLOAT_TYPE
public static final int T_FLOAT_TYPE
- See Also:
- Constant Field Values
-
T_ENUM_TYPE
public static final int T_ENUM_TYPE
- See Also:
- Constant Field Values
-
T_OBJECT_TYPE
public static final int T_OBJECT_TYPE
- See Also:
- Constant Field Values
-
T_ARRAY_TYPE
public static final int T_ARRAY_TYPE
- See Also:
- Constant Field Values
-
T_DOUBLE_TYPE
public static final int T_DOUBLE_TYPE
- See Also:
- Constant Field Values
-
encoding
protected java.lang.String encoding
-
-
Method Detail
-
clone
public DataType clone()
- Overrides:
clone
in classjava.lang.Object
-
nullableInstance
public final DataType nullableInstance(boolean nullable)
-
getEncoding
public final java.lang.String getEncoding()
-
isNullable
public boolean isNullable()
-
setNullable
public void setNullable(boolean nullable)
-
parseEncoding
public void parseEncoding(java.lang.String encoding)
-
parseBoolean
public static boolean parseBoolean(java.lang.String s)
-
parseByte
public static byte parseByte(java.lang.String s)
-
parseShort
public static short parseShort(java.lang.String s)
-
parseInt
public static int parseInt(java.lang.String s)
-
parseLong
public static long parseLong(java.lang.String s)
-
parseDouble
public static double parseDouble(java.lang.String s)
-
parseFloat
public static float parseFloat(java.lang.String s)
-
parseDate
public static long parseDate(java.lang.String s)
-
isConvertible
public abstract DataType.ConversionType isConvertible(DataType to)
-
toBoxedImpl
protected abstract java.lang.Object toBoxedImpl(java.lang.CharSequence text)
Parse non-null text and return an object without checking constraints.
-
toStringImpl
protected abstract java.lang.String toStringImpl(java.lang.Object obj)
Converts a non-null, constraint-compliant Boxed value to String.- Parameters:
obj
- A non-null, valid value.- Returns:
- A String representation.
-
unsupportedType
protected final java.lang.IllegalArgumentException unsupportedType(java.lang.Object obj)
Helper method to construct an exception thrown when object type passed totoString(java.lang.Object)
orassertValid(java.lang.Object)
is completely illegal.- Parameters:
obj
- The culprit.- Returns:
- An exception to throw.
-
outOfRange
protected final java.lang.IllegalArgumentException outOfRange(java.lang.Object obj, java.lang.Object min, java.lang.Object max)
Helper method to construct an exception thrown when a value passed totoString(java.lang.Object)
orassertValid(java.lang.Object)
is out of range.- Parameters:
obj
- The culprit.min
- Inclusive minimum.max
- Inclusive maximum.- Returns:
- An exception to throw.
-
assertValidImpl
protected abstract void assertValidImpl(java.lang.Object obj)
Checks a non-null Boxed value against constraints, if any. If the object is of unsupported type, this method should throwunsupportedType(java.lang.Object)
.- Parameters:
obj
- A Boxed representation of a value.- Throws:
java.lang.IllegalArgumentException
- If constraints are violated.
-
parse
public final java.lang.Object parse(java.lang.CharSequence value)
Convert the String representation to Boxed, also validating it against constraints, if any.Boxed return type should be the same independently from encoding. For example: Long for all INTEGER encodings INT8, INT16 ... INT64
- Parameters:
value
- String representation.- Returns:
- Boxed representation or null if the argument is null.
-
getCode
public abstract int getCode()
-
toString
public final java.lang.String toString(java.lang.Object obj)
Convert the Boxed representation to String, also validating it against constraints, if any.- Parameters:
obj
-
-
assertValid
public final void assertValid(java.lang.Object obj)
Checks a Boxed value against constraints, if any. Overriding methods must call the superclass implementation first.- Parameters:
obj
- A Boxed representation of a value.- Throws:
java.lang.IllegalArgumentException
- If constraints are violated.
-
getBaseName
public abstract java.lang.String getBaseName()
-
writeTo
public void writeTo(java.io.DataOutputStream out) throws java.io.IOException
- Throws:
java.io.IOException
-
readFields
protected void readFields(java.io.DataInputStream in, ClassDescriptor.TypeResolver resolver) throws java.io.IOException
- Throws:
java.io.IOException
-
readFrom
public static DataType readFrom(java.io.DataInputStream in, ClassDescriptor.TypeResolver resolver) throws java.io.IOException
- Throws:
java.io.IOException
-
isPrimitive
public boolean isPrimitive()
-
-