public interface ColumnType
CassandraColumnType subtype exposes Cassandra-specific
DataType information.| Modifier and Type | Method and Description |
|---|---|
static ColumnType |
create(Class<?> type)
Creates a
ColumnType for a Class. |
static CassandraColumnType |
create(Class<?> type,
com.datastax.oss.driver.api.core.type.DataType dataType)
|
static ColumnType |
create(TypeInformation<?> type)
Creates a
ColumnType for a TypeInformation. |
ColumnType |
getComponentType()
Returns the component type for
Collections or the key type for Maps. |
ColumnType |
getMapValueType()
Returns the map value type in case the underlying type is a
Map. |
default ColumnType |
getRequiredComponentType()
Returns the component type for
Collections, the key type for Maps or the single
generic type if available. |
default ColumnType |
getRequiredMapValueType()
Returns the map value type in case the underlying type is a
Map. or throw
IllegalStateException if the map value type cannot be resolved. |
Class<?> |
getType()
Returns the Java type of the column.
|
boolean |
isCollectionLike()
Returns whether the type can be considered a collection, which means it's a container of elements, e.g. a
Collection and Array or anything implementing Iterable. |
boolean |
isList()
Returns whether the property is a
List. |
boolean |
isMap()
Returns whether the property is a
Map. |
boolean |
isSet()
Returns whether the property is a
Set. |
static CassandraColumnType |
listOf(CassandraColumnType componentType)
Creates a List
ColumnType given its component type. |
static CassandraColumnType |
listOf(CassandraColumnType componentType,
boolean frozen)
Creates a List
ColumnType given its component type. |
static ColumnType |
listOf(ColumnType componentType)
Creates a List
ColumnType given its component type. |
static CassandraColumnType |
mapOf(CassandraColumnType keyType,
CassandraColumnType valueType)
Creates a Map
CassandraColumnType given its key and value types. |
static ColumnType |
mapOf(ColumnType keyType,
ColumnType valueType)
Creates a Map
ColumnType given its key and value types. |
static CassandraColumnType |
setOf(CassandraColumnType componentType)
Creates a Set
ColumnType given its component type. |
static CassandraColumnType |
setOf(CassandraColumnType componentType,
boolean frozen)
Creates a Set
ColumnType given its component type. |
static ColumnType |
setOf(ColumnType componentType)
Creates a Set
ColumnType given its component type. |
static CassandraColumnType |
tupleOf(com.datastax.oss.driver.api.core.type.TupleType dataType)
Creates a Tuple
CassandraColumnType given its Cassandra type. |
static CassandraColumnType |
udtOf(com.datastax.oss.driver.api.core.type.UserDefinedType dataType)
Creates a UDT
CassandraColumnType given its Cassandra type. |
static ColumnType create(Class<?> type)
ColumnType for a Class.type - must not be null.static ColumnType create(TypeInformation<?> type)
ColumnType for a TypeInformation.type - must not be null.static CassandraColumnType create(Class<?> type, com.datastax.oss.driver.api.core.type.DataType dataType)
type - must not be null.dataType - must not be null.static ColumnType listOf(ColumnType componentType)
ColumnType given its component type.componentType - must not be null.static CassandraColumnType listOf(CassandraColumnType componentType)
ColumnType given its component type.componentType - must not be null.static CassandraColumnType listOf(CassandraColumnType componentType, boolean frozen)
ColumnType given its component type.componentType - must not be null.frozen - static ColumnType setOf(ColumnType componentType)
ColumnType given its component type.componentType - must not be null.static CassandraColumnType setOf(CassandraColumnType componentType)
ColumnType given its component type.componentType - must not be null.static CassandraColumnType setOf(CassandraColumnType componentType, boolean frozen)
ColumnType given its component type.componentType - must not be null.frozen - static ColumnType mapOf(ColumnType keyType, ColumnType valueType)
ColumnType given its key and value types.keyType - must not be null.valueType - must not be null.static CassandraColumnType mapOf(CassandraColumnType keyType, CassandraColumnType valueType)
CassandraColumnType given its key and value types.keyType - must not be null.valueType - must not be null.static CassandraColumnType udtOf(com.datastax.oss.driver.api.core.type.UserDefinedType dataType)
CassandraColumnType given its Cassandra type.dataType - must not be null.static CassandraColumnType tupleOf(com.datastax.oss.driver.api.core.type.TupleType dataType)
CassandraColumnType given its Cassandra type.dataType - must not be null.Class<?> getType()
boolean isCollectionLike()
Collection and Array or anything implementing Iterable. If this
returns true you can expect getComponentType() to return a non-null value.boolean isList()
List. If this returns true you can expect
getComponentType() to return something not null.boolean isSet()
Set. If this returns true you can expect
getComponentType() to return something not null.boolean isMap()
Map. If this returns true you can expect
getComponentType() as well as getMapValueType() to return something not null.@Nullable ColumnType getComponentType()
Collections or the key type for Maps.default ColumnType getRequiredComponentType()
Collections, the key type for Maps or the single
generic type if available. Throws IllegalStateException if the component value type cannot be resolved.IllegalStateException - if the component type cannot be resolved, e.g. if a raw type is used or the type is
not generic in the first place.@Nullable ColumnType getMapValueType()
Map.default ColumnType getRequiredMapValueType()
Map. or throw
IllegalStateException if the map value type cannot be resolved.IllegalStateException - if the map value type cannot be resolved, usually due to the current
Map type being a raw one.Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.