All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.tarantool.driver.api.tuple.operations.TupleOperationDelete Maven / Gradle / Ivy

Go to download

Tarantool Cartridge driver for Tarantool versions 1.10+ based on Netty framework

There is a newer version: 0.14.0
Show newest version
package io.tarantool.driver.api.tuple.operations;


/**
 * Represents deletion operation on tuple
 *
 * @author Sergey Volgin
 */
public class TupleOperationDelete extends TupleUpdateOperation {

    public TupleOperationDelete(int fieldIndex, int value) {
        super(TarantoolUpdateOperationType.DELETE, fieldIndex, value);
        checkValue(value);
    }

    public TupleOperationDelete(String fieldName, int value) {
        super(TarantoolUpdateOperationType.DELETE, fieldName, value);
        checkValue(value);
    }

    private TupleOperationDelete(TarantoolUpdateOperationType operationType, Integer fieldIndex,
                                 String fieldName, Object value, boolean isProxyOperation) {
        super(operationType, fieldIndex, fieldName, value, isProxyOperation);
    }

    @Override
    public TupleOperation toProxyTupleOperation() {
        return new TupleOperationDelete(
                this.getOperationType(),
                this.getFieldNumber(),
                this.getFieldName(),
                this.getValue(),
                true
        );
    }

    private void checkValue(int value) {
        if (value <= 0) {
            throw new IllegalArgumentException("The number of fields to remove must be greater than zero");
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy