public abstract class DataType extends Object
Modifier and Type | Class and Description |
---|---|
static class |
DataType.CollectionType |
static class |
DataType.CustomType |
static class |
DataType.Name
The CQL type name.
|
static class |
DataType.NativeType |
Modifier and Type | Field and Description |
---|---|
protected DataType.Name |
name |
Modifier | Constructor and Description |
---|---|
protected |
DataType(DataType.Name name) |
Modifier and Type | Method and Description |
---|---|
static Set<DataType> |
allPrimitiveTypes()
Returns a set of all the primitive types, where primitive types are
defined as the types that don't have type arguments (that is excluding
lists, sets, maps, tuples and udts).
|
static DataType |
ascii()
Returns the ASCII type.
|
static DataType |
bigint()
Returns the BIGINT type.
|
static DataType |
blob()
Returns the BLOB type.
|
static DataType |
cboolean()
Returns the BOOLEAN type.
|
static DataType |
cdouble()
Returns the DOUBLE type.
|
static DataType |
cfloat()
Returns the FLOAT type.
|
static DataType |
cint()
Returns the INT type.
|
static DataType |
counter()
Returns the COUNTER type.
|
static DataType |
custom(String typeClassName)
Returns a Custom type.
|
static DataType |
date()
Returns the DATE type.
|
static DataType |
decimal()
Returns the DECIMAL type.
|
static DataType.CollectionType |
frozenList(DataType elementType)
Returns the type of frozen lists of
elementType elements. |
static DataType.CollectionType |
frozenMap(DataType keyType,
DataType valueType)
Returns the type of frozen maps of
keyType to valueType elements. |
static DataType.CollectionType |
frozenSet(DataType elementType)
Returns the type of frozen sets of
elementType elements. |
DataType.Name |
getName()
Returns the name of that type.
|
List<DataType> |
getTypeArguments()
Returns the type arguments of this type.
|
static DataType |
inet()
Returns the INET type.
|
boolean |
isCollection()
Returns whether this data type represent a CQL
collection type ,
that is, a list, set or map. |
abstract boolean |
isFrozen()
Returns whether this data type is frozen.
|
static DataType.CollectionType |
list(DataType elementType)
Returns the type of "not frozen" lists of
elementType elements. |
static DataType.CollectionType |
list(DataType elementType,
boolean frozen)
Returns the type of lists of
elementType elements. |
static DataType.CollectionType |
map(DataType keyType,
DataType valueType)
Returns the type of "not frozen" maps of
keyType to valueType elements. |
static DataType.CollectionType |
map(DataType keyType,
DataType valueType,
boolean frozen)
Returns the type of maps of
keyType to valueType elements. |
static DataType.CollectionType |
set(DataType elementType)
Returns the type of "not frozen" sets of
elementType elements. |
static DataType.CollectionType |
set(DataType elementType,
boolean frozen)
Returns the type of sets of
elementType elements. |
static DataType |
smallint()
Returns the SMALLINT type.
|
static DataType |
text()
Returns the TEXT type.
|
static DataType |
time()
Returns the TIME type.
|
static DataType |
timestamp()
Returns the TIMESTAMP type.
|
static DataType |
timeuuid()
Returns the TIMEUUID type.
|
static DataType |
tinyint()
Returns the TINYINT type.
|
static DataType |
uuid()
Returns the UUID type.
|
static DataType |
varchar()
Returns the VARCHAR type.
|
static DataType |
varint()
Returns the VARINT type.
|
protected final DataType.Name name
protected DataType(DataType.Name name)
public static DataType ascii()
public static DataType bigint()
public static DataType blob()
public static DataType cboolean()
public static DataType counter()
public static DataType decimal()
public static DataType cdouble()
public static DataType cfloat()
public static DataType inet()
public static DataType tinyint()
public static DataType smallint()
public static DataType cint()
public static DataType text()
public static DataType timestamp()
public static DataType date()
public static DataType time()
public static DataType uuid()
public static DataType varchar()
public static DataType varint()
public static DataType timeuuid()
public static DataType.CollectionType list(DataType elementType, boolean frozen)
elementType
elements.elementType
- the type of the list elements.frozen
- whether the list is frozen.elementType
elements.public static DataType.CollectionType list(DataType elementType)
elementType
elements.
This is a shorthand for list(elementType, false);
.
elementType
- the type of the list elements.elementType
elements.public static DataType.CollectionType frozenList(DataType elementType)
elementType
elements.
This is a shorthand for list(elementType, true);
.
elementType
- the type of the list elements.elementType
elements.public static DataType.CollectionType set(DataType elementType, boolean frozen)
elementType
elements.elementType
- the type of the set elements.frozen
- whether the set is frozen.elementType
elements.public static DataType.CollectionType set(DataType elementType)
elementType
elements.
This is a shorthand for set(elementType, false);
.
elementType
- the type of the set elements.elementType
elements.public static DataType.CollectionType frozenSet(DataType elementType)
elementType
elements.
This is a shorthand for set(elementType, true);
.
elementType
- the type of the set elements.elementType
elements.public static DataType.CollectionType map(DataType keyType, DataType valueType, boolean frozen)
keyType
to valueType
elements.keyType
- the type of the map keys.valueType
- the type of the map values.frozen
- whether the map is frozen.keyType
to valueType
elements.public static DataType.CollectionType map(DataType keyType, DataType valueType)
keyType
to valueType
elements.
This is a shorthand for map(keyType, valueType, false);
.
keyType
- the type of the map keys.valueType
- the type of the map values.keyType
to valueType
elements.public static DataType.CollectionType frozenMap(DataType keyType, DataType valueType)
keyType
to valueType
elements.
This is a shorthand for map(keyType, valueType, true);
.
keyType
- the type of the map keys.valueType
- the type of the map values.keyType
to valueType
elements.public static DataType custom(String typeClassName)
A custom type is defined by the name of the class used on the Cassandra side to implement it. Note that the support for custom type by the driver is limited.
The use of custom types is rarely useful and is thus not encouraged.
typeClassName
- the server-side fully qualified class name for the type.typeClassName
.public DataType.Name getName()
public abstract boolean isFrozen()
This applies to User Defined Types, tuples and nested collections. Frozen types are serialized as a single value in Cassandra's storage engine, whereas non-frozen types are stored in a form that allows updates to individual subfields.
public boolean isCollection()
collection type
,
that is, a list, set or map.public List<DataType> getTypeArguments()
Note that only the collection types (LIST, MAP, SET) have type arguments. For the other types, this will return an empty list.
For the collection types:
Copyright © 2012–2015. All rights reserved.