public interface ColumnDefinitions extends Iterable<ColumnDefinition>, Detachable
The default implementation returned by the driver is immutable and serializable. If you write your own implementation, it should at least be thread-safe; serializability is not mandatory, but recommended for use with some 3rd-party tools like Apache Spark ™.
Modifier and Type | Method and Description |
---|---|
boolean |
contains(CqlIdentifier id)
Whether there is a definition using the given CQL identifier.
|
boolean |
contains(String name)
Whether there is a definition using the given name.
|
int |
firstIndexOf(CqlIdentifier id)
Returns the index of the first column that uses the given identifier.
|
int |
firstIndexOf(String name)
Returns the index of the first column that uses the given name.
|
default ColumnDefinition |
get(CqlIdentifier name)
Get a definition by name.
|
ColumnDefinition |
get(int i) |
default ColumnDefinition |
get(String name)
Get a definition by name.
|
int |
size() |
forEach, iterator, spliterator
attach, isDetached
int size()
@NonNull ColumnDefinition get(int i)
i
- the index to check.i
th ColumnDefinition
in this metadata.IndexOutOfBoundsException
- if the index is invalid.@NonNull default ColumnDefinition get(@NonNull String name)
This is the equivalent of:
get(firstIndexOf(name))
IllegalArgumentException
- if the name does not exist (in other words, if !contains(name))
).contains(String)
,
firstIndexOf(String)
@NonNull default ColumnDefinition get(@NonNull CqlIdentifier name)
This is the equivalent of:
get(firstIndexOf(name))
IllegalArgumentException
- if the name does not exist (in other words, if !contains(name))
).contains(CqlIdentifier)
,
firstIndexOf(CqlIdentifier)
boolean contains(@NonNull String name)
Because raw strings are ambiguous with regard to case-sensitivity, the argument will be
interpreted according to the rules described in AccessibleByName
.
boolean contains(@NonNull CqlIdentifier id)
int firstIndexOf(@NonNull String name)
Because raw strings are ambiguous with regard to case-sensitivity, the argument will be
interpreted according to the rules described in AccessibleByName
.
Also, note that if multiple columns use the same name, there is no way to find the index for the next occurrences. One way to avoid this is to use aliases in your CQL queries.
int firstIndexOf(@NonNull CqlIdentifier id)
Note that if multiple columns use the same identifier, there is no way to find the index for the next occurrences. One way to avoid this is to use aliases in your CQL queries.
Copyright © 2017–2024. All rights reserved.