io.tarantool.driver.api.conditions.BaseCondition Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cartridge-driver Show documentation
Show all versions of cartridge-driver Show documentation
Tarantool Cartridge driver for Tarantool versions 1.10+ based on Netty framework
package io.tarantool.driver.api.conditions;
import io.tarantool.driver.metadata.TarantoolMetadataOperations;
import io.tarantool.driver.metadata.TarantoolSpaceMetadata;
import java.util.Arrays;
import java.util.List;
/**
* Basic class for tuple filtering conditions
*
* @author Alexey Kuzin
*/
public abstract class BaseCondition implements Condition {
private final Operator operator;
private final FieldIdentifier, ?> field;
public BaseCondition(Operator operator, FieldIdentifier, ?> field) {
this.operator = operator;
this.field = field;
}
@Override
public Operator operator() {
return operator;
}
@Override
public FieldIdentifier, ?> field() {
return field;
}
@Override
public List> toList(TarantoolMetadataOperations metadataOperations, TarantoolSpaceMetadata spaceMetadata) {
return Arrays.asList(operator.getCode(), field.toIdentifier(), value());
}
}