Package io.tarantool.driver.api.tuple
Interface TarantoolTuple
-
- All Superinterfaces:
Iterable<TarantoolField>
,Packable
,Serializable
- All Known Implementing Classes:
TarantoolTupleImpl
public interface TarantoolTuple extends Iterable<TarantoolField>, Packable
Basic Tarantool atom of data
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canGetObject(int fieldPosition, Class<?> objectClass)
Check if a tuple field exists and can be converted to the target value typeboolean
canGetObject(String fieldName, Class<?> objectClass)
Check if a tuple field exists and can be converted to the target value typeBoolean
getBoolean(int fieldPosition)
Get the field value converted toBoolean
Boolean
getBoolean(String fieldName)
Get the field value converted toBoolean
byte[]
getByteArray(int fieldPosition)
Get the field value converted tobyte[]
byte[]
getByteArray(String fieldName)
Get the field value converted tobyte[]
Character
getCharacter(int fieldPosition)
Get the field value converted toCharacter
Character
getCharacter(String fieldName)
Get the field value converted toCharacter
BigDecimal
getDecimal(int fieldPosition)
Get the field value converted toBigDecimal
BigDecimal
getDecimal(String fieldName)
Get the field value converted toBigDecimal
Double
getDouble(int fieldPosition)
Get the field value converted toDouble
Double
getDouble(String fieldName)
Get the field value converted toDouble
Optional<TarantoolField>
getField(int fieldPosition)
Get a tuple field by its positionOptional<TarantoolField>
getField(String fieldName)
Get a tuple field by its nameList<TarantoolField>
getFields()
Get all tuple fields as listFloat
getFloat(int fieldPosition)
Get the field value converted toFloat
Float
getFloat(String fieldName)
Get the field value converted toFloat
Integer
getInteger(int fieldPosition)
Get the field value converted toInteger
Integer
getInteger(String fieldName)
Get the field value converted toInteger
List<?>
getList(int fieldPosition)
Get the field value converted toList
List<?>
getList(String fieldName)
Get the field value converted toList
Long
getLong(int fieldPosition)
Get the field value converted toLong
Long
getLong(String fieldName)
Get the field value converted toLong
Map<?,?>
getMap(int fieldPosition)
Get the field value converted toMap
Map<?,?>
getMap(String fieldName)
Get the field value converted toMap
Optional<?>
getObject(int fieldPosition)
Get a tuple field value as a raw object<O> Optional<O>
getObject(int fieldPosition, Class<O> objectClass)
Get a tuple field value by its position specifying the target value typeOptional<?>
getObject(String fieldName)
Get a tuple field value as a raw object<O> Optional<O>
getObject(String fieldName, Class<O> objectClass)
Get a tuple field value by its name specifying the target value typeString
getString(int fieldPosition)
Get the field value converted toString
String
getString(String fieldName)
Get the field value converted toString
UUID
getUUID(int fieldPosition)
Get the field value converted toUUID
UUID
getUUID(String fieldName)
Get the field value converted toUUID
void
putObject(int fieldPosition, Object value)
Set a tuple field value from an object by field positionvoid
putObject(String fieldName, Object value)
Set a tuple field value from an object by field namevoid
setField(int fieldPosition, TarantoolField field)
Set a tuple field by field positionvoid
setField(String fieldName, TarantoolField field)
Set a tuple field by field nameint
size()
Get the number of fields in this tuple-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Methods inherited from interface io.tarantool.driver.protocol.Packable
toMessagePackValue
-
-
-
-
Method Detail
-
getField
Optional<TarantoolField> getField(int fieldPosition)
Get a tuple field by its position- Parameters:
fieldPosition
- the field position from the the tuple start, starting from 0- Returns:
- field or empty optional if the field position is out of tuple length
-
getField
Optional<TarantoolField> getField(String fieldName)
Get a tuple field by its name- Parameters:
fieldName
- the field name in space- Returns:
- field or empty optional if the field not exist in space
-
getFields
List<TarantoolField> getFields()
Get all tuple fields as list- Returns:
- all tuple fields as list
-
getObject
<O> Optional<O> getObject(int fieldPosition, Class<O> objectClass)
Get a tuple field value by its position specifying the target value type- Type Parameters:
O
- target value type- Parameters:
fieldPosition
- field position from the the tuple start, starting from 0objectClass
- target value type class- Returns:
- nullable value of a field wrapped in Optional, possibly converted to a Java type
-
canGetObject
boolean canGetObject(int fieldPosition, Class<?> objectClass)
Check if a tuple field exists and can be converted to the target value type- Parameters:
fieldPosition
- field position from the the tuple start, starting from 0objectClass
- target value type class- Returns:
- true, if the field exists and can be converted to the given type, false otherwise
-
getObject
<O> Optional<O> getObject(String fieldName, Class<O> objectClass)
Get a tuple field value by its name specifying the target value type- Type Parameters:
O
- target value type- Parameters:
fieldName
- field name, should not be nullobjectClass
- target value type class- Returns:
- nullable value of a field wrapped in Optional, possibly converted to a Java type
-
canGetObject
boolean canGetObject(String fieldName, Class<?> objectClass)
Check if a tuple field exists and can be converted to the target value type- Parameters:
fieldName
- field name, should not be nullobjectClass
- target value type class- Returns:
- true, if the field exists and can be converted to the given type, false otherwise
-
getObject
Optional<?> getObject(int fieldPosition)
Get a tuple field value as a raw object- Parameters:
fieldPosition
- field position from the the tuple start, starting from 0- Returns:
- nullable value of a field wrapped in Optional
-
getObject
Optional<?> getObject(String fieldName)
Get a tuple field value as a raw object- Parameters:
fieldName
- field name, should not be null- Returns:
- nullable value of a field wrapped in Optional
-
size
int size()
Get the number of fields in this tuple- Returns:
- the number of fields in this tuple
-
setField
void setField(int fieldPosition, TarantoolField field)
Set a tuple field by field position- Parameters:
fieldPosition
- the field position from the the tuple start, starting from 0field
- new field
-
setField
void setField(String fieldName, TarantoolField field)
Set a tuple field by field name- Parameters:
fieldName
- the field name, must be not nullfield
- new field
-
putObject
void putObject(int fieldPosition, Object value)
Set a tuple field value from an object by field position- Parameters:
fieldPosition
- the field position from the the tuple start, starting from 0value
- new field value
-
putObject
void putObject(String fieldName, Object value)
Set a tuple field value from an object by field name- Parameters:
fieldName
- the field name, must not be nullvalue
- new field value
-
getByteArray
byte[] getByteArray(int fieldPosition)
Get the field value converted tobyte[]
- Parameters:
fieldPosition
- the field position from the the tuple start, starting from 0- Returns:
- value
-
getByteArray
byte[] getByteArray(String fieldName)
Get the field value converted tobyte[]
- Parameters:
fieldName
- the field name, must not be null- Returns:
- value
-
getBoolean
Boolean getBoolean(int fieldPosition)
Get the field value converted toBoolean
- Parameters:
fieldPosition
- the field position from the the tuple start, starting from 0- Returns:
- value
-
getBoolean
Boolean getBoolean(String fieldName)
Get the field value converted toBoolean
- Parameters:
fieldName
- the field name, must not be null- Returns:
- value
-
getDouble
Double getDouble(int fieldPosition)
Get the field value converted toDouble
- Parameters:
fieldPosition
- the field position from the the tuple start, starting from 0- Returns:
- value
-
getDouble
Double getDouble(String fieldName)
Get the field value converted toDouble
- Parameters:
fieldName
- the field name, must not be null- Returns:
- value
-
getFloat
Float getFloat(int fieldPosition)
Get the field value converted toFloat
- Parameters:
fieldPosition
- the field position from the the tuple start, starting from 0- Returns:
- value
-
getFloat
Float getFloat(String fieldName)
Get the field value converted toFloat
- Parameters:
fieldName
- the field name, must not be null- Returns:
- value
-
getInteger
Integer getInteger(int fieldPosition)
Get the field value converted toInteger
- Parameters:
fieldPosition
- the field position from the the tuple start, starting from 0- Returns:
- value
-
getInteger
Integer getInteger(String fieldName)
Get the field value converted toInteger
- Parameters:
fieldName
- the field name, must not be null- Returns:
- value
-
getLong
Long getLong(int fieldPosition)
Get the field value converted toLong
- Parameters:
fieldPosition
- the field position from the the tuple start, starting from 0- Returns:
- value
-
getLong
Long getLong(String fieldName)
Get the field value converted toLong
- Parameters:
fieldName
- the field name, must not be null- Returns:
- value
-
getString
String getString(int fieldPosition)
Get the field value converted toString
- Parameters:
fieldPosition
- the field position from the the tuple start, starting from 0- Returns:
- value
-
getString
String getString(String fieldName)
Get the field value converted toString
- Parameters:
fieldName
- the field name, must not be null- Returns:
- value
-
getCharacter
Character getCharacter(int fieldPosition)
Get the field value converted toCharacter
- Parameters:
fieldPosition
- the field position from the the tuple start, starting from 0- Returns:
- value
-
getCharacter
Character getCharacter(String fieldName)
Get the field value converted toCharacter
- Parameters:
fieldName
- the field name, must not be null- Returns:
- value
-
getUUID
UUID getUUID(int fieldPosition)
Get the field value converted toUUID
- Parameters:
fieldPosition
- the field position from the the tuple start, starting from 0- Returns:
- value
-
getUUID
UUID getUUID(String fieldName)
Get the field value converted toUUID
- Parameters:
fieldName
- the field name, must not be null- Returns:
- value
-
getDecimal
BigDecimal getDecimal(int fieldPosition)
Get the field value converted toBigDecimal
- Parameters:
fieldPosition
- the field position from the the tuple start, starting from 0- Returns:
- value
-
getDecimal
BigDecimal getDecimal(String fieldName)
Get the field value converted toBigDecimal
- Parameters:
fieldName
- the field name, must not be null- Returns:
- value
-
getList
List<?> getList(int fieldPosition)
Get the field value converted toList
- Parameters:
fieldPosition
- the field position from the the tuple start, starting from 0- Returns:
- value
-
getList
List<?> getList(String fieldName)
Get the field value converted toList
- Parameters:
fieldName
- the field name, must not be null- Returns:
- value
-
getMap
Map<?,?> getMap(int fieldPosition)
Get the field value converted toMap
- Parameters:
fieldPosition
- the field position from the the tuple start, starting from 0- Returns:
- value
-
-