public class ColumnDefinitions extends Object implements Iterable<ColumnDefinitions.Definition>
ResultSet
or a
PreparedStatement
.
A columnDefinitions
} instance is mainly a list of
ColumnsDefinitions.Definition
. The definitions or metadata for a column
can be accessed either by:
cd
contains column fOO
, then cd.contains("foo")
,
cd.contains("fOO")
and cd.contains("Foo")
will return true
.cd
contains both foo
and FOO
then:
cd.getType("foo")
, cd.getType("fOO")
and cd.getType("FOO")
will all match column foo
.cd.getType("\"FOO\"")
will match column FOO
ColumnDefinitions
object
contains multiple occurrences of the exact same name (be it 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.
|
Modifier and Type | Method and Description |
---|---|
List<ColumnDefinitions.Definition> |
asList()
Returns a list containing all the definitions of this metadata in order.
|
boolean |
contains(String name)
Returns whether this metadata contains a given name.
|
int |
getIndexOf(String name)
The first index in this metadata of the provided name, if present.
|
String |
getKeyspace(int i)
Returns the keyspace of the
i th column in this metadata. |
String |
getKeyspace(String name)
Returns the keyspace of the first occurrence of
name in this metadata. |
String |
getName(int i)
Returns the name of the
i th column in this metadata. |
String |
getTable(int i)
Returns the table of the
i th column in this metadata. |
String |
getTable(String name)
Returns the table of first occurrence of
name in this metadata. |
DataType |
getType(int i)
Returns the type of the
i th column in this metadata. |
DataType |
getType(String name)
Returns the type of the first occurrence of
name in this metadata. |
Iterator<ColumnDefinitions.Definition> |
iterator()
Returns an iterator over the
ColumnDefinitions.Definition contained in this metadata. |
int |
size()
Returns the number of columns described by this
Columns
instance. |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public int size()
Columns
instance.public boolean contains(String name)
name
- the name to check.true
if this metadata contains the column named name
,
false
otherwise.public int getIndexOf(String name)
name
- the name of the column.name
in this metadata if
contains(name)
, -1 otherwise.public Iterator<ColumnDefinitions.Definition> iterator()
ColumnDefinitions.Definition
contained in this metadata.
The order of the iterator will be the one of this metadata.iterator
in interface Iterable<ColumnDefinitions.Definition>
ColumnDefinitions.Definition
contained in this metadata.public List<ColumnDefinitions.Definition> asList()
ColumnDefinitions.Definition
contained in this metadata.public String getName(int i)
i
th column in this metadata.i
- the index in this metadata.i
th column in this metadata.IndexOutOfBoundsException
- if i < 0
or i >= size()
public DataType getType(int i)
i
th column in this metadata.
Note that this method does not set the DataType.isFrozen()
flag on the returned
object, it will always default to false
. Use Cluster.getMetadata()
to
determine if a column is frozen.
i
- the index in this metadata.i
th column in this metadata.IndexOutOfBoundsException
- if i < 0
or i >= size()
public DataType getType(String name)
name
in this metadata.
Note that this method does not set the DataType.isFrozen()
flag on the returned
object, it will always default to false
. Use Cluster.getMetadata()
to
determine if a column is frozen.
name
- the name of the column.name
in this metadata.IllegalArgumentException
- if name
is not in this metadata.public String getKeyspace(int i)
i
th column in this metadata.i
- the index in this metadata.i
th column in this metadata.IndexOutOfBoundsException
- if i < 0
or i >= size()
public String getKeyspace(String name)
name
in this metadata.name
- the name of the column.name
in this metadata.IllegalArgumentException
- if name
is not in this metadata.public String getTable(int i)
i
th column in this metadata.i
- the index in this metadata.i
th column in this metadata.IndexOutOfBoundsException
- if i < 0
or i >= size()
public String getTable(String name)
name
in this metadata.name
- the name of the column.name
in this metadata.IllegalArgumentException
- if name
is not in this metadata.Copyright © 2012–2017. All rights reserved.