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> implements Serializable
An enumeration that represents the types that StreamBase supports.Note: Serializations of instances of this class that are created (e.g., by using
ObjectOutputStream
) in one version of StreamBase in general will not be deserializable in any other version of StreamBase.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DataType.Checklist
-
Enum Constant Summary
Enum Constants Enum Constant Description BLOB
Blob type of undefined length.BOOL
Boolean type, four bytes.CAPTURE
Capture type; opaque, variable lengthDOUBLE
Double type, eight bytes.FUNCTION
Function type: variable length, arguments: Schema, return: CompleteDataTypeINT
Integer type, four bytes.LIST
List type, variable lengthLONG
Long type, eight bytes.STRING
String type of user-defined length.TIMESTAMP
Timestamp type, eight byte storage.TUPLE
sub-schema, variable length
-
Field Summary
Fields Modifier and Type Field Description static DataType[]
SIMPLE_TYPES
The types that have no parameterization, just values.static int
VARIABLE_SIZE
-
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 DataType
forName(String typeName)
For the given name return a DataType Object.static DataType
forType(Class<?> clazz)
Return the appropriate DataType for the given clazz.static DataType
forType(Object obj)
Return the appropriate DataType for the given type.String
getName()
Get the name of this DataType.int
getSize()
Get the size in bytes of this DataType.boolean
isLexicallyComparable()
Returns true if we guarantee lexical comparisons between values of this type work.boolean
isVariableSize()
Return whether this DataType is of variable size or not (currently only for STRING and BLOB).String
toString()
Return the name of the DataType.static String
typeNameFor(Class<?> clazz)
Return the type name for the given Class type.static DataType
valueOf(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
- 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 (currently only for STRING and BLOB).- 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
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.
-
-