public class UDTValue extends AbstractGettableData
| Modifier and Type | Field and Description |
|---|---|
protected ProtocolVersion |
protocolVersion |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkType(int i,
DataType.Name name) |
protected DataType.Name |
checkType(int i,
DataType.Name name1,
DataType.Name name2) |
protected DataType.Name |
checkType(int i,
DataType.Name name1,
DataType.Name name2,
DataType.Name name3) |
boolean |
equals(Object o) |
protected int[] |
getAllIndexesOf(String name) |
boolean |
getBool(int i)
Returns the
ith value as a boolean. |
ByteBuffer |
getBytes(int i)
Returns the
ith value as a byte array. |
ByteBuffer |
getBytesUnsafe(int i)
Returns the
ith value as a ByteBuffer. |
Date |
getDate(int i)
Returns the
ith value as a date. |
BigDecimal |
getDecimal(int i)
Returns the
ith value as a variable length decimal. |
double |
getDouble(int i)
Returns the
ith value as a double. |
float |
getFloat(int i)
Returns the
ith value as a float. |
protected int |
getIndexOf(String name)
Returns the index corresponding to a given name.
|
InetAddress |
getInet(int i)
Returns the
ith value as an InetAddress. |
int |
getInt(int i)
Returns the
ith value as an integer. |
<T> List<T> |
getList(int i,
Class<T> elementsClass)
Returns the
ith value as a list. |
<T> List<T> |
getList(int i,
TypeToken<T> elementsType)
Returns the
ith value as a list. |
long |
getLong(int i)
Returns the
ith value as a long. |
<K,V> Map<K,V> |
getMap(int i,
Class<K> keysClass,
Class<V> valuesClass)
Returns the
ith value as a map. |
<K,V> Map<K,V> |
getMap(int i,
TypeToken<K> keysType,
TypeToken<V> valuesType)
Returns the
ith value as a map. |
protected String |
getName(int i)
Returns the name corresponding to the value at index
i. |
Object |
getObject(int i)
Returns the
ith value as the Java type matching its CQL type. |
<T> Set<T> |
getSet(int i,
Class<T> elementsClass)
Returns the
ith value as a set. |
<T> Set<T> |
getSet(int i,
TypeToken<T> elementsType)
Returns the
ith value as a set. |
String |
getString(int i)
Returns the
ith value as a string. |
TupleValue |
getTupleValue(int i)
Return the
ith value as a tuple value. |
UserType |
getType()
The UDT this is a value of.
|
protected DataType |
getType(int i)
Returns the type for the value at index
i. |
UDTValue |
getUDTValue(int i)
Return the
ith value as a UDT value. |
UUID |
getUUID(int i)
Returns the
ith value as a UUID. |
protected ByteBuffer |
getValue(int i)
Returns the value at index
i. |
BigInteger |
getVarint(int i)
Returns the
ith value as a variable length integer. |
int |
hashCode() |
boolean |
isNull(int i)
Returns whether the
ith value is NULL. |
T |
setBool(int i,
boolean v)
Sets the
ith value to the provided boolean. |
T |
setBool(String name,
boolean v)
Sets the value for (all occurrences of) variable
name to the
provided boolean. |
T |
setBytes(int i,
ByteBuffer v)
Sets the
ith value to the provided byte buffer. |
T |
setBytes(String name,
ByteBuffer v)
Sets the value for (all occurrences of) variable
name to the
provided byte buffer. |
T |
setBytesUnsafe(int i,
ByteBuffer v)
Sets the
ith value to the provided byte buffer. |
T |
setBytesUnsafe(String name,
ByteBuffer v)
Sets the value for (all occurrences of) variable
name to the
provided byte buffer. |
T |
setDate(int i,
Date v)
Set the
ith value to the provided date. |
T |
setDate(String name,
Date v)
Sets the value for (all occurrences of) variable
name to the
provided date. |
T |
setDecimal(int i,
BigDecimal v)
Sets the
ith value to the provided big decimal. |
T |
setDecimal(String name,
BigDecimal v)
Sets the value for (all occurrences of) variable
name to the
provided big decimal. |
T |
setDouble(int i,
double v)
Sets the
ith value to the provided double. |
T |
setDouble(String name,
double v)
Sets the value for (all occurrences of) variable
name to the
provided double. |
T |
setFloat(int i,
float v)
Sets the
ith value to the provided float. |
T |
setFloat(String name,
float v)
Sets the value for (all occurrences of) variable
name to the
provided float. |
T |
setInet(int i,
InetAddress v)
Sets the
ith value to the provided inet address. |
T |
setInet(String name,
InetAddress v)
Sets the value for (all occurrences of) variable
name to the
provided inet address. |
T |
setInt(int i,
int v)
Set the
ith value to the provided integer. |
T |
setInt(String name,
int v)
Sets the value for (all occurrences of) variable
name to the
provided integer. |
<E> T |
setList(int i,
List<E> v)
Sets the
ith value to the provided list. |
<E> T |
setList(String name,
List<E> v)
Sets the value for (all occurrences of) variable
name to the
provided list. |
T |
setLong(int i,
long v)
Sets the
ith value to the provided long. |
T |
setLong(String name,
long v)
Sets the value for (all occurrences of) variable
name to the
provided long. |
<K,V> T |
setMap(int i,
Map<K,V> v)
Sets the
ith value to the provided map. |
<K,V> T |
setMap(String name,
Map<K,V> v)
Sets the value for (all occurrences of) variable
name to the
provided map. |
<E> T |
setSet(int i,
Set<E> v)
Sets the
ith value to the provided set. |
<E> T |
setSet(String name,
Set<E> v)
Sets the value for (all occurrences of) variable
name to the
provided set. |
T |
setString(int i,
String v)
Sets the
ith value to the provided string. |
T |
setString(String name,
String v)
Sets the value for (all occurrences of) variable
name to the
provided string. |
T |
setToNull(int i)
Sets the
ith value to null. |
T |
setToNull(String name)
Sets the value for (all occurrences of) variable
name to null. |
T |
setTupleValue(int i,
TupleValue v)
Sets the
ith value to the provided tuple value. |
T |
setTupleValue(String name,
TupleValue v)
Sets the value for (all occurrences of) variable
name to the
provided tuple value. |
T |
setUDTValue(int i,
UDTValue v)
Sets the
ith value to the provided UDT value. |
T |
setUDTValue(String name,
UDTValue v)
Sets the value for (all occurrences of) variable
name to the
provided UDT value. |
T |
setUUID(int i,
UUID v)
Sets the
ith value to the provided UUID. |
T |
setUUID(String name,
UUID v)
Sets the value for (all occurrences of) variable
name to the
provided UUID. |
T |
setVarint(int i,
BigInteger v)
Sets the
ith value to the provided big integer. |
T |
setVarint(String name,
BigInteger v)
Sets the value for (all occurrences of) variable
name to the
provided big integer. |
String |
toString() |
getBool, getBytes, getBytesUnsafe, getDate, getDecimal, getDouble, getFloat, getInet, getInt, getList, getList, getLong, getMap, getMap, getObject, getSet, getSet, getString, getTupleValue, getUDTValue, getUUID, getVarint, isNullclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetBool, getBytes, getBytesUnsafe, getDate, getDecimal, getDouble, getFloat, getInet, getInt, getList, getList, getLong, getMap, getMap, getObject, getSet, getSet, getString, getTupleValue, getUDTValue, getUUID, getVarint, isNullprotected final ProtocolVersion protocolVersion
protected DataType getType(int i)
i.i - the index of the type to fetch.i.protected String getName(int i)
i.i - the index of the name to fetch.i.protected int[] getAllIndexesOf(String name)
public UserType getType()
public boolean equals(Object o)
public int hashCode()
protected ByteBuffer getValue(int i)
i.i - the index to fetch.i.protected int getIndexOf(String name)
AbstractGettableDatagetIndexOf in class AbstractGettableDataname - the name for which to return the index of.name.public T setBool(int i,
boolean v)
SettableByIndexDataith value to the provided boolean.setBool in interface SettableByIndexData<T extends SettableData<T>>i - the index of the value to set.v - the value to set.public T setBool(String name, boolean v)
SettableByNameDataname to the
provided boolean.setBool in interface SettableByNameData<T extends SettableData<T>>name - the name of the value to set; if name is present multiple
times, all its values are set.v - the value to set.public T setInt(int i,
int v)
SettableByIndexDataith value to the provided integer.setInt in interface SettableByIndexData<T extends SettableData<T>>i - the index of the value to set.v - the value to set.public T setInt(String name, int v)
SettableByNameDataname to the
provided integer.setInt in interface SettableByNameData<T extends SettableData<T>>name - the name of the value to set; if name is present multiple
times, all its values are set.v - the value to set.public T setLong(int i,
long v)
SettableByIndexDataith value to the provided long.setLong in interface SettableByIndexData<T extends SettableData<T>>i - the index of the value to set.v - the value to set.public T setLong(String name, long v)
SettableByNameDataname to the
provided long.setLong in interface SettableByNameData<T extends SettableData<T>>name - the name of the value to set; if name is present multiple
times, all its values are set.v - the value to set.public T setDate(int i,
Date v)
SettableByIndexDataith value to the provided date.setDate in interface SettableByIndexData<T extends SettableData<T>>i - the index of the value to set.v - the value to set.public T setDate(String name, Date v)
SettableByNameDataname to the
provided date.setDate in interface SettableByNameData<T extends SettableData<T>>name - the name of the value to set; if name is present multiple
times, all its values are set.v - the value to set.public T setFloat(int i,
float v)
SettableByIndexDataith value to the provided float.setFloat in interface SettableByIndexData<T extends SettableData<T>>i - the index of the value to set.v - the value to set.public T setFloat(String name, float v)
SettableByNameDataname to the
provided float.setFloat in interface SettableByNameData<T extends SettableData<T>>name - the name of the value to set; if name is present multiple
times, all its values are set.v - the value to set.public T setDouble(int i,
double v)
SettableByIndexDataith value to the provided double.setDouble in interface SettableByIndexData<T extends SettableData<T>>i - the index of the value to set.v - the value to set.public T setDouble(String name, double v)
SettableByNameDataname to the
provided double.setDouble in interface SettableByNameData<T extends SettableData<T>>name - the name of the value to set; if name is present multiple
times, all its values are set.v - the value to set.public T setString(int i,
String v)
SettableByIndexDataith value to the provided string.setString in interface SettableByIndexData<T extends SettableData<T>>i - the index of the value to set.v - the value to set.public T setString(String name, String v)
SettableByNameDataname to the
provided string.setString in interface SettableByNameData<T extends SettableData<T>>name - the name of the value to set; if name is present multiple
times, all its values are set.v - the value to set.public T setBytes(int i,
ByteBuffer v)
SettableByIndexDataith value to the provided byte buffer.
This method validate that the type of the column set is BLOB. If you
want to insert manually serialized data into columns of another type,
use SettableByIndexData.setBytesUnsafe(int, java.nio.ByteBuffer) instead.setBytes in interface SettableByIndexData<T extends SettableData<T>>i - the index of the value to set.v - the value to set.public T setBytes(String name, ByteBuffer v)
SettableByNameDataname to the
provided byte buffer.
This method validate that the type of the column set is BLOB. If you
want to insert manually serialized data into columns of another type,
use SettableByNameData.setBytesUnsafe(java.lang.String, java.nio.ByteBuffer) instead.setBytes in interface SettableByNameData<T extends SettableData<T>>name - the name of the value to set; if name is present multiple
times, all its values are set.v - the value to set.public T setBytesUnsafe(int i,
ByteBuffer v)
SettableByIndexDataith value to the provided byte buffer.
Contrary to SettableByIndexData.setBytes(int, java.nio.ByteBuffer), this method does not check the
type of the column set. If you insert data that is not compatible with
the type of the column, you will get an InvalidQueryException at
execute time.setBytesUnsafe in interface SettableByIndexData<T extends SettableData<T>>i - the index of the value to set.v - the value to set.public T setBytesUnsafe(String name, ByteBuffer v)
SettableByNameDataname to the
provided byte buffer.
Contrary to SettableByNameData.setBytes(java.lang.String, java.nio.ByteBuffer), this method does not check the
type of the column set. If you insert data that is not compatible with
the type of the column, you will get an InvalidQueryException at
execute time.setBytesUnsafe in interface SettableByNameData<T extends SettableData<T>>name - the name of the value to set; if name is present multiple
times, all its values are set.v - the value to set.public T setVarint(int i,
BigInteger v)
SettableByIndexDataith value to the provided big integer.setVarint in interface SettableByIndexData<T extends SettableData<T>>i - the index of the value to set.v - the value to set.public T setVarint(String name, BigInteger v)
SettableByNameDataname to the
provided big integer.setVarint in interface SettableByNameData<T extends SettableData<T>>name - the name of the value to set; if name is present multiple
times, all its values are set.v - the value to set.public T setDecimal(int i,
BigDecimal v)
SettableByIndexDataith value to the provided big decimal.setDecimal in interface SettableByIndexData<T extends SettableData<T>>i - the index of the value to set.v - the value to set.public T setDecimal(String name, BigDecimal v)
SettableByNameDataname to the
provided big decimal.setDecimal in interface SettableByNameData<T extends SettableData<T>>name - the name of the value to set; if name is present multiple
times, all its values are set.v - the value to set.public T setUUID(int i,
UUID v)
SettableByIndexDataith value to the provided UUID.setUUID in interface SettableByIndexData<T extends SettableData<T>>i - the index of the value to set.v - the value to set.public T setUUID(String name, UUID v)
SettableByNameDataname to the
provided UUID.setUUID in interface SettableByNameData<T extends SettableData<T>>name - the name of the value to set; if name is present multiple
times, all its values are set.v - the value to set.public T setInet(int i,
InetAddress v)
SettableByIndexDataith value to the provided inet address.setInet in interface SettableByIndexData<T extends SettableData<T>>i - the index of the value to set.v - the value to set.public T setInet(String name, InetAddress v)
SettableByNameDataname to the
provided inet address.setInet in interface SettableByNameData<T extends SettableData<T>>name - the name of the value to set; if name is present multiple
times, all its values are set.v - the value to set.public <E> T setList(int i,
List<E> v)
SettableByIndexDataith value to the provided list.
Please note that null values are not supported inside collection by CQL.setList in interface SettableByIndexData<T extends SettableData<T>>i - the index of the value to set.v - the value to set.public <E> T setList(String name, List<E> v)
SettableByNameDataname to the
provided list.
Please note that null values are not supported inside collection by CQL.setList in interface SettableByNameData<T extends SettableData<T>>name - the name of the value to set; if name is present multiple
times, all its values are set.v - the value to set.public <K,V> T setMap(int i,
Map<K,V> v)
SettableByIndexDataith value to the provided map.
Please note that null values are not supported inside collection by CQL.setMap in interface SettableByIndexData<T extends SettableData<T>>i - the index of the value to set.v - the value to set.public <K,V> T setMap(String name, Map<K,V> v)
SettableByNameDataname to the
provided map.
Please note that null values are not supported inside collection by CQL.setMap in interface SettableByNameData<T extends SettableData<T>>name - the name of the value to set; if name is present multiple
times, all its values are set.v - the value to set.public <E> T setSet(int i,
Set<E> v)
SettableByIndexDataith value to the provided set.
Please note that null values are not supported inside collection by CQL.setSet in interface SettableByIndexData<T extends SettableData<T>>i - the index of the value to set.v - the value to set.public <E> T setSet(String name, Set<E> v)
SettableByNameDataname to the
provided set.
Please note that null values are not supported inside collection by CQL.setSet in interface SettableByNameData<T extends SettableData<T>>name - the name of the value to set; if name is present multiple
times, all its values are set.v - the value to set.public T setUDTValue(int i,
UDTValue v)
SettableByIndexDataith value to the provided UDT value.setUDTValue in interface SettableByIndexData<T extends SettableData<T>>i - the index of the value to set.v - the value to set.public T setUDTValue(String name, UDTValue v)
SettableByNameDataname to the
provided UDT value.setUDTValue in interface SettableByNameData<T extends SettableData<T>>name - the name of the value to set; if name is present multiple
times, all its values are set.v - the value to set.public T setTupleValue(int i,
TupleValue v)
SettableByIndexDataith value to the provided tuple value.setTupleValue in interface SettableByIndexData<T extends SettableData<T>>i - the index of the value to set.v - the value to set.public T setTupleValue(String name, TupleValue v)
SettableByNameDataname to the
provided tuple value.setTupleValue in interface SettableByNameData<T extends SettableData<T>>name - the name of the value to set; if name is present multiple
times, all its values are set.v - the value to set.public T setToNull(int i)
SettableByIndexDataith value to null.
This is mainly intended for CQL types which map to native Java types.setToNull in interface SettableByIndexData<T extends SettableData<T>>i - the index of the value to set.public T setToNull(String name)
SettableByNameDataname to null.
This is mainly intended for CQL types which map to native Java types.setToNull in interface SettableByNameData<T extends SettableData<T>>name - the name of the value to set; if name is present multiple
times, all its values are set.protected void checkType(int i,
DataType.Name name)
protected DataType.Name checkType(int i, DataType.Name name1, DataType.Name name2)
protected DataType.Name checkType(int i, DataType.Name name1, DataType.Name name2, DataType.Name name3)
public boolean isNull(int i)
ith value is NULL.isNull in interface GettableByIndexDatai - the index (0 <= i < size()) of the value to check.ith value is NULL.public boolean getBool(int i)
ith value as a boolean.getBool in interface GettableByIndexDatai - the index (0 <= i < size()) to retrieve.ith element. If the
value is NULL, false is returned.public int getInt(int i)
ith value as an integer.getInt in interface GettableByIndexDatai - the index (0 <= i < size()) to retrieve.ith element as an integer. If the
value is NULL, 0 is returned.public long getLong(int i)
ith value as a long.getLong in interface GettableByIndexDatai - the index (0 <= i < size()) to retrieve.ith element as a long. If the
value is NULL, 0L is returned.public Date getDate(int i)
ith value as a date.getDate in interface GettableByIndexDatai - the index (0 <= i < size()) to retrieve.ith element as a data. If the
value is NULL, null is returned.public float getFloat(int i)
ith value as a float.getFloat in interface GettableByIndexDatai - the index (0 <= i < size()) to retrieve.ith element as a float. If the
value is NULL, 0.0f is returned.public double getDouble(int i)
ith value as a double.getDouble in interface GettableByIndexDatai - the index (0 <= i < size()) to retrieve.ith element as a double. If the
value is NULL, 0.0 is returned.public ByteBuffer getBytesUnsafe(int i)
ith value as a ByteBuffer.
Note: this method always return the bytes composing the value, even if
the column is not of type BLOB. That is, this method never throw an
InvalidTypeException. However, if the type is not BLOB, it is up to the
caller to handle the returned value correctly.getBytesUnsafe in interface GettableByIndexDatai - the index (0 <= i < size()) to retrieve.ith element as a ByteBuffer. If the
value is NULL, null is returned.public ByteBuffer getBytes(int i)
ith value as a byte array.
Note that this method validate that the column is of type BLOB. If you want to retrieve
the bytes for any type, use GettableByIndexData.getBytesUnsafe(int) instead.getBytes in interface GettableByIndexDatai - the index (0 <= i < size()) to retrieve.ith element as a byte array. If the
value is NULL, null is returned.public String getString(int i)
ith value as a string.getString in interface GettableByIndexDatai - the index (0 <= i < size()) to retrieve.ith element as a string. If the
value is NULL, null is returned.public BigInteger getVarint(int i)
ith value as a variable length integer.getVarint in interface GettableByIndexDatai - the index (0 <= i < size()) to retrieve.ith element as a variable
length integer. If the value is NULL, null is returned.public BigDecimal getDecimal(int i)
ith value as a variable length decimal.getDecimal in interface GettableByIndexDatai - the index (0 <= i < size()) to retrieve.ith element as a variable
length decimal. If the value is NULL, null is returned.public UUID getUUID(int i)
ith value as a UUID.getUUID in interface GettableByIndexDatai - the index (0 <= i < size()) to retrieve.ith element as a UUID.
If the value is NULL, null is returned.public InetAddress getInet(int i)
ith value as an InetAddress.getInet in interface GettableByIndexDatai - the index (0 <= i < size()) to retrieve.ith element as an InetAddress.
If the value is NULL, null is returned.public <T> List<T> getList(int i, Class<T> elementsClass)
ith value as a list.
If the type of the elements is generic, use GettableByIndexData.getList(int, TypeToken).getList in interface GettableByIndexDatai - the index (0 <= i < size()) to retrieve.elementsClass - the class for the elements of the list to retrieve.ith element as a list of
T objects. If the value is NULL, an empty list is
returned (note that Cassandra makes no difference between an empty list
and column of type list that is not set). The returned list is immutable.public <T> List<T> getList(int i, TypeToken<T> elementsType)
ith value as a list.
Use this variant with nested collections, which produce a generic element type:
List<List<String>> l = row.getList(1, new TypeToken<List<String>>() {});
getList in interface GettableByIndexDatai - the index (0 <= i < size()) to retrieve.elementsType - the type of the elements of the list to retrieve.ith element as a list of
T objects. If the value is NULL, an empty list is
returned (note that Cassandra makes no difference between an empty list
and column of type list that is not set). The returned list is immutable.public <T> Set<T> getSet(int i, Class<T> elementsClass)
ith value as a set.
If the type of the elements is generic, use GettableByIndexData.getSet(int, TypeToken).getSet in interface GettableByIndexDatai - the index (0 <= i < size()) to retrieve.elementsClass - the class for the elements of the set to retrieve.ith element as a set of
T objects. If the value is NULL, an empty set is
returned (note that Cassandra makes no difference between an empty set
and column of type set that is not set). The returned set is immutable.public <T> Set<T> getSet(int i, TypeToken<T> elementsType)
ith value as a set.
Use this variant with nested collections, which produce a generic element type:
Set<List<String>> l = row.getSet(1, new TypeToken<List<String>>() {});
getSet in interface GettableByIndexDatai - the index (0 <= i < size()) to retrieve.elementsType - the type for the elements of the set to retrieve.ith element as a set of
T objects. If the value is NULL, an empty set is
returned (note that Cassandra makes no difference between an empty set
and column of type set that is not set). The returned set is immutable.public <K,V> Map<K,V> getMap(int i, Class<K> keysClass, Class<V> valuesClass)
ith value as a map.
If the type of the keys and/or values is generic, use GettableByIndexData.getMap(int, TypeToken, TypeToken).getMap in interface GettableByIndexDatai - the index (0 <= i < size()) to retrieve.keysClass - the class for the keys of the map to retrieve.valuesClass - the class for the values of the map to retrieve.ith element as a map of
K to V objects. If the value is NULL,
an empty map is returned (note that Cassandra makes no difference
between an empty map and column of type map that is not set). The
returned map is immutable.public <K,V> Map<K,V> getMap(int i, TypeToken<K> keysType, TypeToken<V> valuesType)
ith value as a map.
Use this variant with nested collections, which produce a generic element type:
Map<Int, List<String>> l = row.getMap(1, TypeToken.of(Integer.class), new TypeToken<List<String>>() {});
getMap in interface GettableByIndexDatai - the index (0 <= i < size()) to retrieve.keysType - the type for the keys of the map to retrieve.valuesType - the type for the values of the map to retrieve.ith element as a map of
K to V objects. If the value is NULL,
an empty map is returned (note that Cassandra makes no difference
between an empty map and column of type map that is not set). The
returned map is immutable.public UDTValue getUDTValue(int i)
ith value as a UDT value.getUDTValue in interface GettableByIndexDatai - the index (0 <= i < size()) to retrieve.ith element as a UDT value. If the value is NULL,
then null will be returned.public TupleValue getTupleValue(int i)
ith value as a tuple value.getTupleValue in interface GettableByIndexDatai - the index (0 <= i < size()) to retrieve.ith element as a tuple value. If the value is NULL,
then null will be returned.public Object getObject(int i)
ith value as the Java type matching its CQL type.getObject in interface GettableByIndexDatai - the index to retrieve.ith value as the Java type matching its CQL type.
If the value is NULL and is a simple type, UDT or tuple, null is returned.
If it is NULL and is a collection type, an empty (immutable) collection is returned.