Class TarantoolTupleImpl

    • Constructor Detail

      • TarantoolTupleImpl

        public TarantoolTupleImpl​(MessagePackMapper mapper)
        Constructor for empty tuple
        Parameters:
        mapper - provides conversion between MessagePack values and Java objects
      • TarantoolTupleImpl

        public TarantoolTupleImpl​(MessagePackMapper mapper,
                                  TarantoolSpaceMetadata metadata)
        Constructor for empty tuple with metadata
        Parameters:
        mapper - provides conversion between MessagePack values and Java objects
        metadata - provides information about the target space
      • TarantoolTupleImpl

        public TarantoolTupleImpl​(Collection<?> values,
                                  MessagePackMapper mapper)
        Construct an instance of TarantoolTuple from a list of objects
        Parameters:
        values - list of tuple fields data
        mapper - provides conversion between MessagePack values and Java objects
      • TarantoolTupleImpl

        public TarantoolTupleImpl​(Collection<?> values,
                                  MessagePackMapper mapper,
                                  TarantoolSpaceMetadata metadata)
        Construct an instance of TarantoolTuple from a list of objects. Provides space metadata which adds extra functionality for working with fields and indexes.
        Parameters:
        values - list of tuple fields data
        mapper - provides conversion between MessagePack values and Java objects
        metadata - provides information about the target space
      • TarantoolTupleImpl

        public TarantoolTupleImpl​(org.msgpack.value.ArrayValue value,
                                  MessagePackMapper mapper)
        Construct an instance of TarantoolTuple
        Parameters:
        value - serialized Tarantool tuple
        mapper - provides conversion between MessagePack values and Java objects
      • TarantoolTupleImpl

        public TarantoolTupleImpl​(org.msgpack.value.ArrayValue value,
                                  MessagePackMapper mapper,
                                  TarantoolSpaceMetadata spaceMetadata)
        Basic constructor. Used for converting Tarantool server responses into Java entities.
        Parameters:
        value - serialized Tarantool tuple
        mapper - provides conversion between MessagePack values and Java objects
        spaceMetadata - provides field names and other metadata
    • Method Detail

      • getField

        public Optional<TarantoolField> getField​(int fieldPosition)
        Description copied from interface: TarantoolTuple
        Get a tuple field by its position
        Specified by:
        getField in interface TarantoolTuple
        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

        public Optional<TarantoolField> getField​(String fieldName)
        Description copied from interface: TarantoolTuple
        Get a tuple field by its name
        Specified by:
        getField in interface TarantoolTuple
        Parameters:
        fieldName - the field name in space
        Returns:
        field or empty optional if the field not exist in space
      • getObject

        public <O> Optional<O> getObject​(int fieldPosition,
                                         Class<O> objectClass)
        Description copied from interface: TarantoolTuple
        Get a tuple field value by its position specifying the target value type
        Specified by:
        getObject in interface TarantoolTuple
        Type Parameters:
        O - target value type
        Parameters:
        fieldPosition - field position from the the tuple start, starting from 0
        objectClass - target value type class
        Returns:
        nullable value of a field wrapped in Optional, possibly converted to a Java type
      • canGetObject

        public boolean canGetObject​(int fieldPosition,
                                    Class<?> objectClass)
        Description copied from interface: TarantoolTuple
        Check if a tuple field exists and can be converted to the target value type
        Specified by:
        canGetObject in interface TarantoolTuple
        Parameters:
        fieldPosition - field position from the the tuple start, starting from 0
        objectClass - target value type class
        Returns:
        true, if the field exists and can be converted to the given type, false otherwise
      • getObject

        public <O> Optional<O> getObject​(String fieldName,
                                         Class<O> objectClass)
        Description copied from interface: TarantoolTuple
        Get a tuple field value by its name specifying the target value type
        Specified by:
        getObject in interface TarantoolTuple
        Type Parameters:
        O - target value type
        Parameters:
        fieldName - field name, should not be null
        objectClass - target value type class
        Returns:
        nullable value of a field wrapped in Optional, possibly converted to a Java type
      • canGetObject

        public boolean canGetObject​(String fieldName,
                                    Class<?> objectClass)
        Description copied from interface: TarantoolTuple
        Check if a tuple field exists and can be converted to the target value type
        Specified by:
        canGetObject in interface TarantoolTuple
        Parameters:
        fieldName - field name, should not be null
        objectClass - target value type class
        Returns:
        true, if the field exists and can be converted to the given type, false otherwise
      • getObject

        public Optional<?> getObject​(int fieldPosition)
        Description copied from interface: TarantoolTuple
        Get a tuple field value as a raw object
        Specified by:
        getObject in interface TarantoolTuple
        Parameters:
        fieldPosition - field position from the the tuple start, starting from 0
        Returns:
        nullable value of a field wrapped in Optional
      • getObject

        public Optional<?> getObject​(String fieldName)
        Description copied from interface: TarantoolTuple
        Get a tuple field value as a raw object
        Specified by:
        getObject in interface TarantoolTuple
        Parameters:
        fieldName - field name, should not be null
        Returns:
        nullable value of a field wrapped in Optional
      • toMessagePackValue

        public org.msgpack.value.Value toMessagePackValue​(MessagePackObjectMapper mapper)
        Description copied from interface: Packable
        Convert this instance into a corresponding MessagePack Value
        Specified by:
        toMessagePackValue in interface Packable
        Parameters:
        mapper - configured Java objects to entities mapper
        Returns:
        MessagePack entity
      • size

        public int size()
        Description copied from interface: TarantoolTuple
        Get the number of fields in this tuple
        Specified by:
        size in interface TarantoolTuple
        Returns:
        the number of fields in this tuple
      • setField

        public void setField​(int fieldPosition,
                             TarantoolField field)
        Description copied from interface: TarantoolTuple
        Set a tuple field by field position
        Specified by:
        setField in interface TarantoolTuple
        Parameters:
        fieldPosition - the field position from the the tuple start, starting from 0
        field - new field
      • setField

        public void setField​(String fieldName,
                             TarantoolField field)
        Description copied from interface: TarantoolTuple
        Set a tuple field by field name
        Specified by:
        setField in interface TarantoolTuple
        Parameters:
        fieldName - the field name, must be not null
        field - new field
      • putObject

        public void putObject​(int fieldPosition,
                              Object value)
        Description copied from interface: TarantoolTuple
        Set a tuple field value from an object by field position
        Specified by:
        putObject in interface TarantoolTuple
        Parameters:
        fieldPosition - the field position from the the tuple start, starting from 0
        value - new field value
      • putObject

        public void putObject​(String fieldName,
                              Object value)
        Description copied from interface: TarantoolTuple
        Set a tuple field value from an object by field name
        Specified by:
        putObject in interface TarantoolTuple
        Parameters:
        fieldName - the field name, must not be null
        value - new field value
      • getByteArray

        public byte[] getByteArray​(int fieldPosition)
        Description copied from interface: TarantoolTuple
        Get the field value converted to byte[]
        Specified by:
        getByteArray in interface TarantoolTuple
        Parameters:
        fieldPosition - the field position from the the tuple start, starting from 0
        Returns:
        value
      • getByteArray

        public byte[] getByteArray​(String fieldName)
        Description copied from interface: TarantoolTuple
        Get the field value converted to byte[]
        Specified by:
        getByteArray in interface TarantoolTuple
        Parameters:
        fieldName - the field name, must not be null
        Returns:
        value
      • getBoolean

        public Boolean getBoolean​(int fieldPosition)
        Description copied from interface: TarantoolTuple
        Get the field value converted to Boolean
        Specified by:
        getBoolean in interface TarantoolTuple
        Parameters:
        fieldPosition - the field position from the the tuple start, starting from 0
        Returns:
        value
      • getBoolean

        public Boolean getBoolean​(String fieldName)
        Description copied from interface: TarantoolTuple
        Get the field value converted to Boolean
        Specified by:
        getBoolean in interface TarantoolTuple
        Parameters:
        fieldName - the field name, must not be null
        Returns:
        value
      • getDouble

        public Double getDouble​(int fieldPosition)
        Description copied from interface: TarantoolTuple
        Get the field value converted to Double
        Specified by:
        getDouble in interface TarantoolTuple
        Parameters:
        fieldPosition - the field position from the the tuple start, starting from 0
        Returns:
        value
      • getDouble

        public Double getDouble​(String fieldName)
        Description copied from interface: TarantoolTuple
        Get the field value converted to Double
        Specified by:
        getDouble in interface TarantoolTuple
        Parameters:
        fieldName - the field name, must not be null
        Returns:
        value
      • getFloat

        public Float getFloat​(int fieldPosition)
        Description copied from interface: TarantoolTuple
        Get the field value converted to Float
        Specified by:
        getFloat in interface TarantoolTuple
        Parameters:
        fieldPosition - the field position from the the tuple start, starting from 0
        Returns:
        value
      • getFloat

        public Float getFloat​(String fieldName)
        Description copied from interface: TarantoolTuple
        Get the field value converted to Float
        Specified by:
        getFloat in interface TarantoolTuple
        Parameters:
        fieldName - the field name, must not be null
        Returns:
        value
      • getInteger

        public Integer getInteger​(int fieldPosition)
        Description copied from interface: TarantoolTuple
        Get the field value converted to Integer
        Specified by:
        getInteger in interface TarantoolTuple
        Parameters:
        fieldPosition - the field position from the the tuple start, starting from 0
        Returns:
        value
      • getInteger

        public Integer getInteger​(String fieldName)
        Description copied from interface: TarantoolTuple
        Get the field value converted to Integer
        Specified by:
        getInteger in interface TarantoolTuple
        Parameters:
        fieldName - the field name, must not be null
        Returns:
        value
      • getLong

        public Long getLong​(int fieldPosition)
        Description copied from interface: TarantoolTuple
        Get the field value converted to Long
        Specified by:
        getLong in interface TarantoolTuple
        Parameters:
        fieldPosition - the field position from the the tuple start, starting from 0
        Returns:
        value
      • getLong

        public Long getLong​(String fieldName)
        Description copied from interface: TarantoolTuple
        Get the field value converted to Long
        Specified by:
        getLong in interface TarantoolTuple
        Parameters:
        fieldName - the field name, must not be null
        Returns:
        value
      • getString

        public String getString​(int fieldPosition)
        Description copied from interface: TarantoolTuple
        Get the field value converted to String
        Specified by:
        getString in interface TarantoolTuple
        Parameters:
        fieldPosition - the field position from the the tuple start, starting from 0
        Returns:
        value
      • getString

        public String getString​(String fieldName)
        Description copied from interface: TarantoolTuple
        Get the field value converted to String
        Specified by:
        getString in interface TarantoolTuple
        Parameters:
        fieldName - the field name, must not be null
        Returns:
        value
      • getCharacter

        public Character getCharacter​(int fieldPosition)
        Description copied from interface: TarantoolTuple
        Get the field value converted to Character
        Specified by:
        getCharacter in interface TarantoolTuple
        Parameters:
        fieldPosition - the field position from the the tuple start, starting from 0
        Returns:
        value
      • getCharacter

        public Character getCharacter​(String fieldName)
        Description copied from interface: TarantoolTuple
        Get the field value converted to Character
        Specified by:
        getCharacter in interface TarantoolTuple
        Parameters:
        fieldName - the field name, must not be null
        Returns:
        value
      • getUUID

        public UUID getUUID​(int fieldPosition)
        Description copied from interface: TarantoolTuple
        Get the field value converted to UUID
        Specified by:
        getUUID in interface TarantoolTuple
        Parameters:
        fieldPosition - the field position from the the tuple start, starting from 0
        Returns:
        value
      • getUUID

        public UUID getUUID​(String fieldName)
        Description copied from interface: TarantoolTuple
        Get the field value converted to UUID
        Specified by:
        getUUID in interface TarantoolTuple
        Parameters:
        fieldName - the field name, must not be null
        Returns:
        value
      • getDecimal

        public BigDecimal getDecimal​(int fieldPosition)
        Description copied from interface: TarantoolTuple
        Get the field value converted to BigDecimal
        Specified by:
        getDecimal in interface TarantoolTuple
        Parameters:
        fieldPosition - the field position from the the tuple start, starting from 0
        Returns:
        value
      • getList

        public List<?> getList​(int fieldPosition)
        Description copied from interface: TarantoolTuple
        Get the field value converted to List
        Specified by:
        getList in interface TarantoolTuple
        Parameters:
        fieldPosition - the field position from the the tuple start, starting from 0
        Returns:
        value
      • getList

        public List<?> getList​(String fieldName)
        Description copied from interface: TarantoolTuple
        Get the field value converted to List
        Specified by:
        getList in interface TarantoolTuple
        Parameters:
        fieldName - the field name, must not be null
        Returns:
        value
      • getMap

        public Map<?,​?> getMap​(int fieldPosition)
        Description copied from interface: TarantoolTuple
        Get the field value converted to Map
        Specified by:
        getMap in interface TarantoolTuple
        Parameters:
        fieldPosition - the field position from the the tuple start, starting from 0
        Returns:
        value
      • getMap

        public Map<?,​?> getMap​(String fieldName)
        Description copied from interface: TarantoolTuple
        Get the field value converted to Map
        Specified by:
        getMap in interface TarantoolTuple
        Parameters:
        fieldName - the field name, must not be null
        Returns:
        value
      • getFieldPositionByName

        protected int getFieldPositionByName​(String fieldName)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object