Package com.streambase.sb
Enum DataType
- java.lang.Object
-
- java.lang.Enum<DataType>
-
- com.streambase.sb.DataType
-
- All Implemented Interfaces:
Serializable,Comparable<DataType>
public enum DataType extends Enum<DataType>
An enumeration that represents the types that StreamBase supports.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDataType.ChecklistValidate types against registered types
-
Enum Constant Summary
Enum Constants Enum Constant Description BLOBBlob type of undefined length.BOOLBoolean type, four bytes.CAPTURECapture type; opaque, variable lengthDOUBLEDouble type, eight bytes.FUNCTIONFunction type: variable length, arguments: Schema, return: CompleteDataTypeINTInteger type, four bytes.LISTList type, variable lengthLONGLong type, eight bytes.STRINGString type of user-defined length.TIMESTAMPTimestamp type, eight byte storage.TUPLEsub-schema, variable length
-
Field Summary
Fields Modifier and Type Field Description static DataType[]SIMPLE_TYPESThe types that have no parameterization, just values.static intVARIABLE_SIZEIndicator for a variable size data type
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Collection<DataType>allTypes()Deprecated.use DataType.values()static DataTypeforName(String typeName)For the given name return a DataType Object.static DataTypeforType(Class<?> clazz)Return the appropriate DataType for the given clazz.static DataTypeforType(Object obj)Return the appropriate DataType for the given type.StringgetName()Get the name of this DataType.intgetSize()Get the size in bytes of this DataType.booleanisLexicallyComparable()Returns true if we guarantee lexical comparisons between values of this type work.booleanisVariableSize()Return whether this DataType is of variable size or notStringtoString()Return the name of the DataType.static StringtypeNameFor(Class<?> clazz)Return the type name for the given Class type.static DataTypevalueOf(String name)Returns the enum constant of this type with the specified name.static DataType[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INT
public static final DataType INT
Integer type, four bytes.
-
LONG
public static final DataType LONG
Long type, eight bytes.
-
DOUBLE
public static final DataType DOUBLE
Double type, eight bytes.
-
STRING
public static final DataType STRING
String type of user-defined length.
-
BLOB
public static final DataType BLOB
Blob type of undefined length.
-
TIMESTAMP
public static final DataType TIMESTAMP
Timestamp type, eight byte storage.
-
BOOL
public static final DataType BOOL
Boolean type, four bytes.
-
LIST
public static final DataType LIST
List type, variable length
-
TUPLE
public static final DataType TUPLE
sub-schema, variable length
-
CAPTURE
public static final DataType CAPTURE
Capture type; opaque, variable length
-
FUNCTION
public static final DataType FUNCTION
Function type: variable length, arguments: Schema, return: CompleteDataType
-
-
Field Detail
-
SIMPLE_TYPES
public static final DataType[] SIMPLE_TYPES
The types that have no parameterization, just values.
-
VARIABLE_SIZE
public static final int VARIABLE_SIZE
Indicator for a variable size data type- See Also:
- Constant Field Values
-
-
Method Detail
-
values
public static DataType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (DataType c : DataType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static DataType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
isLexicallyComparable
public boolean isLexicallyComparable()
Returns true if we guarantee lexical comparisons between values of this type work.- Returns:
- if lexical comparison works
-
getSize
public int getSize()
Get the size in bytes of this DataType.- Returns:
- the size in bytes of this DataType (VARIABLE_SIZE indicates variable size)
-
getName
public String getName()
Get the name of this DataType.- Returns:
- the name of this DataType
-
forType
public static final DataType forType(Class<?> clazz)
Return the appropriate DataType for the given clazz. Will return null if can't determine the appropriate class.- Parameters:
clazz- an object to determine the class of- Returns:
- appropriate DataType or null if none
-
typeNameFor
public static final String typeNameFor(Class<?> clazz)
Return the type name for the given Class type. If there is no mapping return the original class name- Parameters:
clazz- an object to determine the class of- Returns:
- appropriate DataType name or class name
-
forType
public static DataType forType(Object obj)
Return the appropriate DataType for the given type. Will return null if can't determine the appropriate type.- Parameters:
obj- an object to determine the type of- Returns:
- appropriate DataType or null if none
-
isVariableSize
public boolean isVariableSize()
Return whether this DataType is of variable size or not- Returns:
- true if and only if this DataType is of variable size, false otherwise.
-
toString
public String toString()
Return the name of the DataType.
-
allTypes
@Deprecated public static final Collection<DataType> allTypes()
Deprecated.use DataType.values()Return a read-only Collection of all the types that StreamBase supports.- Returns:
- a collection of all the types that StreamBase Supports.
-
-