public class DataTypeImpl extends Object
DataTypeImpl class provides definition for Cassandra data types
used for columns when one cannot rely on the default behavior where the type is
inferred from the field type.| Modifier and Type | Class and Description |
|---|---|
static class |
DataTypeImpl.Definition
The
Definition class provides a data type definition for a CQL
data type. |
| Constructor and Description |
|---|
DataTypeImpl() |
| Modifier and Type | Method and Description |
|---|---|
static DataTypeImpl.Definition |
inferDataTypeFrom(DataType type,
Class<?> clazz)
Infers the data type from the specified class' superclass.
|
static DataTypeImpl.Definition |
inferDataTypeFrom(Field field)
Infers the data type from the specified field.
|
static boolean |
isAssignableFrom(CQLDataType type,
Class<?> clazz)
Determines if the given data type is either the same as or is a superclass or
super interface of, the class or interface represented by the specified
clazz parameter. |
static boolean |
isInstance(CQLDataType type,
Object object)
Determines if the given object is assignment compatible with this data
type.
|
static Class<?> |
unwrapOptionalIfPresent(Class<?> clazz,
Type type)
Unwraps the specific class if it is an
Optional. |
public static Class<?> unwrapOptionalIfPresent(Class<?> clazz, Type type)
Optional.clazz - the class to unwrap if requiredtype - the corresponding type for the classpublic static DataTypeImpl.Definition inferDataTypeFrom(Field field)
field - the field from which to infer the data typenull data type definitionNullPointerException - if field is nullIllegalArgumentException - if the data type cannot be inferred from
the field or it is persisted but the persister cannot be instantiatepublic static DataTypeImpl.Definition inferDataTypeFrom(DataType type, Class<?> clazz)
type - the collection type being inferredclazz - the class from which to infer the data type of its superclassnull data type definitionNullPointerException - if type or clazz is
nullIllegalArgumentException - if the argument data type cannot be inferred
from the superclass or the specified type is not a collection data typepublic static boolean isAssignableFrom(CQLDataType type, Class<?> clazz)
clazz parameter. It returns true if so; otherwise
it returns false.type - the data type to checkclazz - the class to checktrue if the given class can be assigned to the given data
typepublic static boolean isInstance(CQLDataType type, Object object)
type - the data type to checkobject - the object to checktrue if the given object can be assigned to a column
of this data type; false otherwiseCopyright (C) 2015-2015 The Helenus Driver Project Authors.