public interface UserDefinedType extends DataType, Describable
Modifier and Type | Method and Description |
---|---|
default List<Integer> |
allIndicesOf(CqlIdentifier id) |
default List<Integer> |
allIndicesOf(String name) |
default String |
asCql(boolean includeFrozen,
boolean pretty)
Builds an appropriate representation for use in a CQL query.
|
default boolean |
contains(CqlIdentifier id) |
default boolean |
contains(String name) |
UserDefinedType |
copy(boolean newFrozen) |
default String |
describe(boolean pretty)
Returns a single CQL statement that creates the element.
|
default String |
describeWithChildren(boolean pretty)
Returns a CQL script that creates the element and all of its children.
|
int |
firstIndexOf(CqlIdentifier id) |
int |
firstIndexOf(String name) |
AttachmentPoint |
getAttachmentPoint() |
List<CqlIdentifier> |
getFieldNames() |
List<DataType> |
getFieldTypes() |
CqlIdentifier |
getKeyspace() |
CqlIdentifier |
getName() |
default int |
getProtocolCode()
The code of the data type in the native protocol specification.
|
boolean |
isFrozen() |
UdtValue |
newValue() |
UdtValue |
newValue(Object... fields)
Creates a new instance with the specified values for the fields.
|
attach, isDetached
@Nullable CqlIdentifier getKeyspace()
@NonNull CqlIdentifier getName()
boolean isFrozen()
@NonNull List<CqlIdentifier> getFieldNames()
@NonNull default List<Integer> allIndicesOf(@NonNull CqlIdentifier id)
firstIndexOf(CqlIdentifier)
in a singleton list, which is not entirely correct,
as it will only return the first occurrence. Therefore it also logs a warning.
Implementors should always override this method (all built-in driver implementations do).
int firstIndexOf(@NonNull CqlIdentifier id)
@NonNull default List<Integer> allIndicesOf(@NonNull String name)
firstIndexOf(String)
in a singleton list, which is not entirely correct, as it
will only return the first occurrence. Therefore it also logs a warning.
Implementors should always override this method (all built-in driver implementations do).
int firstIndexOf(@NonNull String name)
default boolean contains(@NonNull CqlIdentifier id)
default boolean contains(@NonNull String name)
@NonNull UserDefinedType copy(boolean newFrozen)
@NonNull UdtValue newValue()
@NonNull UdtValue newValue(@NonNull Object... fields)
To encode the values, this method uses the CodecRegistry
that this type is attached
to; it looks for the best codec to handle the target CQL type
and actual runtime type of each value (see CodecRegistry.codecFor(DataType, Object)
).
fields
- the value of the fields. They must be in the same order as the fields in the
type's definition. You can specify less values than there are fields (the remaining ones
will be set to NULL), but not more (a runtime exception will be thrown). Individual values
can be null
, but the array itself can't.IllegalArgumentException
- if there are too many values.@NonNull AttachmentPoint getAttachmentPoint()
@NonNull default String asCql(boolean includeFrozen, boolean pretty)
DataType
asCql
in interface DataType
includeFrozen
- whether to include the frozen<...>
keyword if applicable. This
will need to be set depending on where the result is used: for example, CREATE
TABLE
statements use the frozen keyword, whereas it should never appear in CREATE
FUNCTION
.pretty
- whether to pretty-print UDT names (as described in CqlIdentifier.asCql(boolean)
.@NonNull default String describe(boolean pretty)
Describable
describe
in interface Describable
pretty
- if true
, make the output more human-readable (line breaks, indents, and
pretty identifiers
). If false
, return the
statement on a single line with minimal formatting.@NonNull default String describeWithChildren(boolean pretty)
Describable
describeWithChildren
in interface Describable
pretty
- if true
, make the output more human-readable (line breaks, indents, and
pretty identifiers
). If false
, return each
statement on a single line with minimal formatting.default int getProtocolCode()
DataType
getProtocolCode
in interface DataType
Copyright © 2017–2024. All rights reserved.