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 |
---|---|
default List<Integer> |
allIndicesOf(CqlIdentifier id)
Returns the indices of all columns that use the given identifier.
|
default List<Integer> |
allIndicesOf(String name)
Returns the indices of all columns that use the given name.
|
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)
@NonNull default List<Integer> allIndicesOf(@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
.
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)
Because raw strings are ambiguous with regard to case-sensitivity, the argument will be
interpreted according to the rules described in AccessibleByName
.
@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)
Copyright © 2017–2024. All rights reserved.