|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.datastax.driver.core.ColumnDefinitions
public class ColumnDefinitions
Metadata describing the columns returned in a 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:
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 with 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 double quoting the name.
For example:
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.
Nested Class Summary | |
---|---|
static class |
ColumnDefinitions.Definition
A column definition. |
Method Summary | |
---|---|
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 povided 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 occurence 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 occurence 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 occurence 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()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
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.
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.
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.public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |