public class ColumnDefinitions extends Object implements Iterable<ColumnDefinitions.Definition>
CassandraResultSet or a CassandraPreparedStatement.
A ColumnDefinitions instance is mainly a list of ColumnDefinitions.Definition. The definitions or metadata for a
column can be accessed either by:
When accessed by name, column selection is case insensitive. In case multiple columns only differ by the case of their name, then the column returned will be the first column that has been defined in CQL without forcing case sensitivity (that is, it has either been defined without quotes or is fully lowercase). If none of the columns have been defined in this manner, the first column matching (with case insensitivity) is returned. You can force the case of a selection by using double quotes (") around the name.
For example, considering cd an instance of ColumnDefinitions:
cd contains column bAR, then cd.contains("bar"), cd.contains("bAR")
and cd.contains("Bar") will return truecd contains both foo and FOO then:
cd.getType("foo"), cd.getType("fOO") and cd.getType("FOO") will all match
the column foocd.getType("\"FOO\"") will match the column FOOColumnDefinitions object contains multiple occurrences of
the exact same name (either the same column multiple times or columns from different tables with the same name),
you will have to use selection by index to disambiguate.
| Modifier and Type | Class and Description |
|---|---|
static class |
ColumnDefinitions.Definition
A column definition.
|
| Constructor and Description |
|---|
ColumnDefinitions(ColumnDefinitions.Definition[] definitions)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
List<ColumnDefinitions.Definition> |
asList()
Returns a list containing all the definitions of these metadata ordered by index.
|
boolean |
contains(String name)
Returns whether these metadata contains a given name.
|
int |
getIndexOf(String name)
Returns the first index in these metadata of the provided column name, if present.
|
String |
getKeyspace(int i)
Returns the keyspace of the
ith column in these metadata. |
String |
getKeyspace(String name)
Returns the keyspace of the first occurrence of the column
name in these metadata. |
String |
getName(int i)
Returns the name of the
ith column in these metadata. |
String |
getTable(int i)
Returns the table name of the
ith column in these metadata. |
String |
getTable(String name)
Returns the table name of the first occurrence of the column
name in these metadata. |
com.datastax.oss.driver.api.core.type.DataType |
getType(int i)
Returns the type of the
ith column in these metadata. |
com.datastax.oss.driver.api.core.type.DataType |
getType(String name)
Returns the type of the first occurrence of the column
name in these metadata. |
Iterator<ColumnDefinitions.Definition> |
iterator()
Returns an iterator over the
ColumnDefinitions.Definition contained in these metadata. |
int |
size()
Returns the number of columns described by this
ColumnDefinitions instance. |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic ColumnDefinitions(ColumnDefinitions.Definition[] definitions)
definitions - Array of columns definitions.public int size()
ColumnDefinitions instance.public boolean contains(String name)
name - The name to check.true if these metadata contains the column named name, false otherwise.public int getIndexOf(String name)
name - The name of the column.@Nonnull public Iterator<ColumnDefinitions.Definition> iterator()
ColumnDefinitions.Definition contained in these metadata.
The order of the iterator will be the one of these metadata.
iterator in interface Iterable<ColumnDefinitions.Definition>ColumnDefinitions.Definition contained in these metadata.public List<ColumnDefinitions.Definition> asList()
ColumnDefinitions.Definition contained in these metadata.public String getName(int i)
ith column in these metadata.i - The index of the column in these metadata (the first column is 0).ith column in these metadata.IndexOutOfBoundsException - if i < 0 or i >= size().public com.datastax.oss.driver.api.core.type.DataType getType(int i)
ith column in these metadata.i - The index of the column in these metadata (the first column is 0).ith column in these metadata.IndexOutOfBoundsException - if i < 0 or i >= size().public com.datastax.oss.driver.api.core.type.DataType getType(String name)
name in these metadata.name - The name of the column.name in these metadata.IllegalArgumentException - if name is not in these metadata.public String getKeyspace(int i)
ith column in these metadata.i - The index of the column in these metadata (the first column is 0).ith column in these metadata.IndexOutOfBoundsException - if i < 0 or i >= size().public String getKeyspace(String name)
name in these metadata.name - The name of the column.name in these metadata.IllegalArgumentException - if name is not in these metadata.public String getTable(int i)
ith column in these metadata.i - The index of the column in these metadata (the first column is 0).ith column in these metadata.IndexOutOfBoundsException - if i < 0 or i >= size().public String getTable(String name)
name in these metadata.name - The name of the column.name in these metadata.IllegalArgumentException - if name is not in these metadata.Copyright © 2020–2024 ING Bank. All rights reserved.