|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.datastax.driver.core.DataType
public class DataType
Data types supported by cassandra.
| Nested Class Summary | |
|---|---|
static class |
DataType.Name
The CQL type name. |
| Method Summary | |
|---|---|
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 (i.e. |
static DataType |
ascii()
The ASCII type. |
Class<?> |
asJavaClass()
The java Class corresponding to this type. |
static DataType |
bigint()
The BIGINT type. |
static DataType |
blob()
The BLOB type. |
static DataType |
cboolean()
The BOOLEAN type. |
static DataType |
cdouble()
The DOUBLE type. |
static DataType |
cfloat()
The FLOAT type. |
static DataType |
cint()
The INT type. |
static DataType |
counter()
The COUNTER type. |
static DataType |
custom(String typeClassName)
A Custom type. |
static DataType |
decimal()
The DECIMAL type. |
boolean |
equals(Object o)
|
String |
getCustomTypeClassName()
The server side class name for a custom types. |
DataType.Name |
getName()
The name of that type. |
List<DataType> |
getTypeArguments()
The type arguments of this type. |
int |
hashCode()
|
static DataType |
inet()
The INET type. |
boolean |
isCollection()
Returns whether this type is a collection one, i.e. |
static DataType |
list(DataType elementType)
The type of lists of elementType elements. |
static DataType |
map(DataType keyType,
DataType valueType)
The type of maps of keyType to valueType elements. |
ByteBuffer |
parse(String value)
Parse a string value for the type this object represent, returning its Cassandra binary representation. |
static DataType |
set(DataType elementType)
The type of sets of elementType elements. |
static DataType |
text()
The TEXT type. |
static DataType |
timestamp()
The TIMESTAMP type. |
static DataType |
timeuuid()
The TIMEUUID type. |
String |
toString()
|
static DataType |
uuid()
The UUID type. |
static DataType |
varchar()
The VARCHAR type. |
static DataType |
varint()
The VARINT type. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
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 cint()
public static DataType text()
public static DataType timestamp()
public static DataType uuid()
public static DataType varchar()
public static DataType varint()
public static DataType timeuuid()
public static DataType list(DataType elementType)
elementType elements.
elementType - the type of the list elements.
elementType elements.public static DataType set(DataType elementType)
elementType elements.
elementType - the type of the set elements.
elementType elements.
public static DataType map(DataType keyType,
DataType valueType)
keyType to valueType elements.
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: values of a custom type won't be interpreted by the
driver in any way. They will thus be expected (by BoundStatement#setBytesUnsafe) and returned (by Row.getBytesUnsafe(int)) as ByteBuffer.
The use of custom types is rarely useful and is thus not encouraged.
Also note that currently, the class implementing the custom type server side must be present in the driver classpath (this restriction should hopefully lifted at some point).
typeClassName - the server-side class name for the type.
typeClassName.public DataType.Name getName()
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:
public String getCustomTypeClassName()
null
for any other type.public ByteBuffer parse(String value)
value - the value to parse.
value.
InvalidTypeException - if value is not a valid string
representation for this type. Please note that values for custom types
can never be parsed and will always return this exception.public boolean isCollection()
public Class<?> asJavaClass()
getName().asJavaClass().
DataType.Name.asJavaClass()public static Set<DataType> allPrimitiveTypes()
public final int hashCode()
hashCode in class Objectpublic final boolean equals(Object o)
equals in class Objectpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||