public interface AccessibleByName extends AccessibleByIndex
This is an optimized version of AccessibleById
, in case the overhead of having to
create a CqlIdentifier
for each value is too much.
By default, case is ignored when matching names. If multiple names only differ by their case, then the first one is chosen. You can force an exact match by double-quoting the name.
For example, if the data structure contains three values named Foo
, foo
and
fOO
, then:
getString("foo")
retrieves the first value (ignore case, first occurrence).
getString("\"foo\"")
retrieves the second value (exact case).
getString("\"fOO\"")
retrieves the third value (exact case).
getString("\"FOO\"")
fails (exact case, no match).
In the driver, these data structures are always accessible by index as well.
Modifier and Type | Method and Description |
---|---|
default List<Integer> |
allIndicesOf(String name)
Returns all the indices where a given identifier appears.
|
int |
firstIndexOf(String name)
Returns the first index where a given identifier appears (depending on the implementation,
identifiers may appear multiple times).
|
DataType |
getType(String name)
Returns the CQL type of the value for the first occurrence of
name . |
getType, size
codecRegistry, protocolVersion
@NonNull default List<Integer> allIndicesOf(@NonNull String name)
IllegalArgumentException
- if the name is invalid.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)
IllegalArgumentException
- if the name is invalid.@NonNull DataType getType(@NonNull String name)
name
.
This method deals with case sensitivity in the way explained in the documentation of GettableByName
.
IllegalArgumentException
- if the name is invalid.Copyright © 2017–2024. All rights reserved.