Class DataType
- Direct Known Subclasses:
DataType.CollectionType,DataType.CustomType,DataType.NativeType,TupleType,UserType,VectorType
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classInstances of this class represent collection types, that is, lists, sets or maps.static classA "custom" type is a type that cannot be expressed as a CQL type.static enumThe CQL type name.static classInstances of this class represent CQL native types, also known as CQL primitive types. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DataTypeascii()Returns the ASCII type.Returns a String representation of this data type suitable for inclusion as a parameter type in a function or aggregate signature.static DataTypebigint()Returns the BIGINT type.static DataTypeblob()Returns the BLOB type.static DataTypecboolean()Returns the BOOLEAN type.static DataTypecdouble()Returns the DOUBLE type.static DataTypecfloat()Returns the FLOAT type.static DataTypecint()Returns the INT type.static DataTypecounter()Returns the COUNTER type.static DataType.CustomTypeReturns a Custom type.static DataTypedate()Returns the DATE type.static DataTypedecimal()Returns the DECIMAL type.static DataTypeduration()Returns the Duration type, introduced in Cassandra 3.10.getName()Returns the name of that type.Returns the type arguments of this type.static DataTypeinet()Returns the INET type.booleanReturns whether this data type represent a CQLcollection type, that is, a list, set or map.abstract booleanisFrozen()Returns whether this data type is frozen.static DataType.CollectionTypeReturns the type of "not frozen" lists ofelementTypeelements.static DataType.CollectionTypeReturns the type of lists ofelementTypeelements.static DataType.CollectionTypeReturns the type of "not frozen" maps ofkeyTypetovalueTypeelements.static DataType.CollectionTypeReturns the type of maps ofkeyTypetovalueTypeelements.static DataType.CollectionTypeReturns the type of "not frozen" sets ofelementTypeelements.static DataType.CollectionTypeReturns the type of sets ofelementTypeelements.static DataTypesmallint()Returns the SMALLINT type.static DataTypetext()Returns the TEXT type.static DataTypetime()Returns the TIME type.static DataTypeReturns the TIMESTAMP type.static DataTypetimeuuid()Returns the TIMEUUID type.static DataTypetinyint()Returns the TINYINT type.static DataTypeuuid()Returns the UUID type.static DataTypevarchar()Returns the VARCHAR type.static DataTypevarint()Returns the VARINT type.static VectorTypeReturns the type of vector ofelementTypeelements withdimensionsdimensions.
-
Field Details
-
name
-
-
Constructor Details
-
DataType
-
-
Method Details
-
ascii
Returns the ASCII type.- Returns:
- The ASCII type.
-
bigint
Returns the BIGINT type.- Returns:
- The BIGINT type.
-
blob
Returns the BLOB type.- Returns:
- The BLOB type.
-
cboolean
Returns the BOOLEAN type.- Returns:
- The BOOLEAN type.
-
counter
Returns the COUNTER type.- Returns:
- The COUNTER type.
-
decimal
Returns the DECIMAL type.- Returns:
- The DECIMAL type.
-
cdouble
Returns the DOUBLE type.- Returns:
- The DOUBLE type.
-
cfloat
Returns the FLOAT type.- Returns:
- The FLOAT type.
-
inet
Returns the INET type.- Returns:
- The INET type.
-
tinyint
Returns the TINYINT type.- Returns:
- The TINYINT type.
-
smallint
Returns the SMALLINT type.- Returns:
- The SMALLINT type.
-
cint
Returns the INT type.- Returns:
- The INT type.
-
text
Returns the TEXT type.- Returns:
- The TEXT type.
-
timestamp
Returns the TIMESTAMP type.- Returns:
- The TIMESTAMP type.
-
date
Returns the DATE type.- Returns:
- The DATE type.
-
time
Returns the TIME type.- Returns:
- The TIME type.
-
uuid
Returns the UUID type.- Returns:
- The UUID type.
-
varchar
Returns the VARCHAR type.- Returns:
- The VARCHAR type.
-
varint
Returns the VARINT type.- Returns:
- The VARINT type.
-
timeuuid
Returns the TIMEUUID type.- Returns:
- The TIMEUUID type.
-
list
Returns the type of lists ofelementTypeelements.- Parameters:
elementType- the type of the list elements.frozen- whether the list is frozen.- Returns:
- the type of lists of
elementTypeelements.
-
list
Returns the type of "not frozen" lists ofelementTypeelements.This is a shorthand for
list(elementType, false);.- Parameters:
elementType- the type of the list elements.- Returns:
- the type of "not frozen" lists of
elementTypeelements.
-
set
Returns the type of sets ofelementTypeelements.- Parameters:
elementType- the type of the set elements.frozen- whether the set is frozen.- Returns:
- the type of sets of
elementTypeelements.
-
set
Returns the type of "not frozen" sets ofelementTypeelements.This is a shorthand for
set(elementType, false);.- Parameters:
elementType- the type of the set elements.- Returns:
- the type of "not frozen" sets of
elementTypeelements.
-
map
Returns the type of maps ofkeyTypetovalueTypeelements.- Parameters:
keyType- the type of the map keys.valueType- the type of the map values.frozen- whether the map is frozen.- Returns:
- the type of maps of
keyTypetovalueTypeelements.
-
map
Returns the type of "not frozen" maps ofkeyTypetovalueTypeelements.This is a shorthand for
map(keyType, valueType, false);.- Parameters:
keyType- the type of the map keys.valueType- the type of the map values.- Returns:
- the type of "not frozen" maps of
keyTypetovalueTypeelements.
-
vector
Returns the type of vector ofelementTypeelements withdimensionsdimensions.- Parameters:
elementType- the type of the vector elements.dimensions- the number of dimensions of the vector.- Returns:
- the type of vectors of
elementTypeelements anddimensionsdimensions.
-
custom
Returns a Custom type.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 types by the driver is limited.
The use of custom types is rarely useful and is thus not encouraged.
- Parameters:
typeClassName- the server-side fully qualified class name for the type.- Returns:
- the custom type for
typeClassName.
-
duration
Returns the Duration type, introduced in Cassandra 3.10.Note that a Duration type does not have a native representation in CQL, and technically, is merely a special
custom typefrom the driver's point of view.- Returns:
- the Duration type. The returned instance is a singleton.
-
getName
Returns the name of that type.- Returns:
- the name of that type.
-
isFrozen
public abstract boolean isFrozen()Returns whether this data type is frozen.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.
- Returns:
- whether this data type is frozen.
-
isCollection
public boolean isCollection()Returns whether this data type represent a CQLcollection type, that is, a list, set or map.- Returns:
- whether this data type name represent the name of a collection type.
-
getTypeArguments
Returns the type arguments of this type.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:
- For lists and sets, this method returns one argument, the type of the elements.
- For maps, this method returns two arguments, the first one is the type of the map keys, the second one is the type of the map values.
- Returns:
- an immutable list containing the type arguments of this type.
-
asFunctionParameterString
Returns a String representation of this data type suitable for inclusion as a parameter type in a function or aggregate signature.In such places, the String representation might vary from the canonical one as returned by
Object.toString(); e.g. thefrozenkeyword is not accepted.- Returns:
- a String representation of this data type suitable for inclusion as a parameter type in a function or aggregate signature.
-