Class TupleOperations


  • public final class TupleOperations
    extends Object
    Create list of TupleOperation for update and upsert requests
    • Method Detail

      • addOperation

        public TupleOperations addOperation​(TupleOperation operation)
        Add operation to the list
        Parameters:
        operation - for field
        Returns:
        this
      • asList

        public List<TupleOperation> asList()
        Get list of operations
        Returns:
        list of operations
      • asProxyOperationList

        public List<TupleOperation> asProxyOperationList()
        Get a list of operations by converting field indexes starts with 0 to position numbers starts with 1 for working with lua box.space API
        Returns:
        list of operations
      • fromTarantoolTuple

        public static TupleOperations fromTarantoolTuple​(TarantoolTuple tuple)
        Build a collection of set operations from passed tuple
        Parameters:
        tuple - tuple, must not be null or empty
        Returns:
        new instance
      • add

        public static TupleOperations add​(int fieldIndex,
                                          Number value)
        Adds the specified value to the field value
        Parameters:
        fieldIndex - field number starting with 0
        value - increment
        Returns:
        new instance
      • andAdd

        public TupleOperations andAdd​(int fieldIndex,
                                      Number value)
        Adds the specified value to the field value
        Parameters:
        fieldIndex - field number starting with 0
        value - increment
        Returns:
        this
      • add

        public static TupleOperations add​(String fieldName,
                                          Number value)
        Adds the specified value to the field value
        Parameters:
        fieldName - field name
        value - increment
        Returns:
        new instance
      • andAdd

        public TupleOperations andAdd​(String fieldName,
                                      Number value)
        Adds the specified value to the field value
        Parameters:
        fieldName - field name
        value - increment
        Returns:
        this
      • bitwiseAnd

        public static TupleOperations bitwiseAnd​(int fieldIndex,
                                                 long value)
        Bitwise AND(&) operation
        Parameters:
        fieldIndex - field number starting with 0
        value - value
        Returns:
        new instance
      • andBitwiseAnd

        public TupleOperations andBitwiseAnd​(int fieldIndex,
                                             long value)
        Bitwise AND(&) operation
        Parameters:
        fieldIndex - field number starting with 0
        value - value
        Returns:
        this
      • bitwiseAnd

        public static TupleOperations bitwiseAnd​(String fieldName,
                                                 long value)
        Bitwise AND(&) operation
        Parameters:
        fieldName - field name
        value - value
        Returns:
        new instance
      • andBitwiseAnd

        public TupleOperations andBitwiseAnd​(String fieldName,
                                             long value)
        Bitwise AND(&) operation
        Parameters:
        fieldName - field name
        value - value
        Returns:
        this
      • bitwiseOr

        public static TupleOperations bitwiseOr​(int fieldIndex,
                                                long value)
        Bitwise OR(|) operation
        Parameters:
        fieldIndex - field number starting with 0
        value - value
        Returns:
        new instance
      • andBitwiseOr

        public TupleOperations andBitwiseOr​(int fieldIndex,
                                            long value)
        Bitwise OR(|) operation
        Parameters:
        fieldIndex - field number starting with 0
        value - value
        Returns:
        this
      • bitwiseOr

        public static TupleOperations bitwiseOr​(String fieldName,
                                                long value)
        Bitwise OR(|) operation
        Parameters:
        fieldName - field name
        value - value
        Returns:
        new instance
      • andBitwiseOr

        public TupleOperations andBitwiseOr​(String fieldName,
                                            long value)
        Bitwise OR(|) operation
        Parameters:
        fieldName - field name
        value - value
        Returns:
        this
      • bitwiseXor

        public static TupleOperations bitwiseXor​(int fieldIndex,
                                                 long value)
        Bitwise XOR(^) operation
        Parameters:
        fieldIndex - field number starting with 0
        value - value
        Returns:
        new instance
      • andBitwiseXor

        public TupleOperations andBitwiseXor​(int fieldIndex,
                                             long value)
        Bitwise XOR(^) operation
        Parameters:
        fieldIndex - field number starting with 0
        value - value
        Returns:
        this
      • bitwiseXor

        public static TupleOperations bitwiseXor​(String fieldName,
                                                 long value)
        Bitwise XOR(^) operation
        Parameters:
        fieldName - field name
        value - value
        Returns:
        new instance
      • andBitwiseXor

        public TupleOperations andBitwiseXor​(String fieldName,
                                             long value)
        Bitwise XOR(^) operation
        Parameters:
        fieldName - field name
        value - value
        Returns:
        this
      • delete

        public static TupleOperations delete​(int fieldIndex,
                                             int fieldsCount)
        Remove field value
        Parameters:
        fieldIndex - start field number starting with 0 to start with
        fieldsCount - the number of fields to remove
        Returns:
        new instance
      • andDelete

        public TupleOperations andDelete​(int fieldIndex,
                                         int fieldsCount)
        Remove field value
        Parameters:
        fieldIndex - start field number starting with 0 to start with
        fieldsCount - the number of fields to remove
        Returns:
        this
      • delete

        public static TupleOperations delete​(String fieldName,
                                             int fieldsCount)
        Remove field value
        Parameters:
        fieldName - field name to start with
        fieldsCount - the number of fields to remove
        Returns:
        new instance
      • andDelete

        public TupleOperations andDelete​(String fieldName,
                                         int fieldsCount)
        Remove field value
        Parameters:
        fieldName - field name to start with
        fieldsCount - the number of fields to remove
        Returns:
        this
      • insert

        public static TupleOperations insert​(int fieldIndex,
                                             Object value)
        Insert field value
        Parameters:
        fieldIndex - field number starting with 0 to insert after
        value - the value to insert
        Returns:
        new instance
      • andInsert

        public TupleOperations andInsert​(int fieldIndex,
                                         Object value)
        Insert field value
        Parameters:
        fieldIndex - field number starting with 0 to insert after
        value - the value to insert
        Returns:
        this
      • insert

        public static TupleOperations insert​(String fieldName,
                                             Object value)
        Insert field value
        Parameters:
        fieldName - field name to insert after
        value - the value to insert
        Returns:
        new instance
      • andInsert

        public TupleOperations andInsert​(String fieldName,
                                         Object value)
        Insert field value
        Parameters:
        fieldName - field name to insert after
        value - the value to insert
        Returns:
        this
      • set

        public static TupleOperations set​(int fieldIndex,
                                          Object value)
        Set field value
        Parameters:
        fieldIndex - field number starting with 0
        value - the new value of a field
        Returns:
        new instance
      • andSet

        public TupleOperations andSet​(int fieldIndex,
                                      Object value)
        Set field value
        Parameters:
        fieldIndex - field number starting with 0
        value - the new value of a field
        Returns:
        this
      • set

        public static TupleOperations set​(String fieldName,
                                          Object value)
        Set field value
        Parameters:
        fieldName - field name
        value - the new value of a field
        Returns:
        new instance
      • andSet

        public TupleOperations andSet​(String fieldName,
                                      Object value)
        Set field value
        Parameters:
        fieldName - field name
        value - the new value of a field
        Returns:
        this
      • splice

        public static TupleOperations splice​(int fieldIndex,
                                             int position,
                                             int offset,
                                             String replacement)
        Replace substring
        Parameters:
        fieldIndex - field number starting with 0
        position - the start'th position
        offset - length of substring
        replacement - new value
        Returns:
        new instance
      • andSplice

        public TupleOperations andSplice​(int fieldIndex,
                                         int position,
                                         int offset,
                                         String replacement)
        Replace substring
        Parameters:
        fieldIndex - field number starting with 0
        position - the start'th position
        offset - length of substring
        replacement - new value
        Returns:
        this
      • splice

        public static TupleOperations splice​(String fieldName,
                                             int position,
                                             int offset,
                                             String replacement)
        Replace substring
        Parameters:
        fieldName - field name
        position - the start'th position
        offset - length of substring
        replacement - new value
        Returns:
        new instance
      • andSplice

        public TupleOperations andSplice​(String fieldName,
                                         int position,
                                         int offset,
                                         String replacement)
        Replace substring
        Parameters:
        fieldName - field name
        position - the start'th position
        offset - length of substring
        replacement - new value
        Returns:
        this
      • subtract

        public static TupleOperations subtract​(int fieldIndex,
                                               Number value)
        Subtracts the specified value to the field value
        Parameters:
        fieldIndex - field number starting with 0
        value - increment
        Returns:
        this
      • andSubtract

        public TupleOperations andSubtract​(int fieldIndex,
                                           Number value)
        Subtracts the specified value to the field value
        Parameters:
        fieldIndex - field number starting with 0
        value - increment
        Returns:
        this
      • subtract

        public static TupleOperations subtract​(String fieldName,
                                               Number value)
        Subtracts the specified value to the field value
        Parameters:
        fieldName - field name
        value - increment
        Returns:
        this
      • andSubtract

        public TupleOperations andSubtract​(String fieldName,
                                           Number value)
        Subtracts the specified value to the field value
        Parameters:
        fieldName - field name
        value - increment
        Returns:
        this