io.tarantool.driver.core.proxy.CRUDSelectOptions Maven / Gradle / Ivy
Show all versions of cartridge-driver Show documentation
package io.tarantool.driver.core.proxy;
import io.tarantool.driver.protocol.Packable;
import java.util.List;
import java.util.Optional;
/**
* This class is not part of the public API.
*
* Represent options for select cluster proxy operation
*
* @author Sergey Volgin
* @author Alexey Kuzin
* @author Artyom Dubinin
*/
final class CRUDSelectOptions extends CRUDBucketIdOptions {
public static final String SELECT_LIMIT = "first";
public static final String SELECT_AFTER = "after";
public static final String SELECT_BATCH_SIZE = "batch_size";
public static final String FIELDS = "fields";
private > CRUDSelectOptions(AbstractBuilder builder) {
super(builder);
addOption(SELECT_LIMIT, builder.selectLimit);
addOption(SELECT_AFTER, builder.after);
addOption(SELECT_BATCH_SIZE, builder.selectBatchSize);
addOption(FIELDS, builder.fields);
}
/**
* Inheritable Builder for select cluster proxy operation options.
*
* @see CRUDAbstractOperationOptions.AbstractBuilder
*/
protected abstract static class AbstractBuilder>
extends CRUDBucketIdOptions.AbstractBuilder {
private Optional selectLimit = Optional.empty();
private Optional after = Optional.empty();
private Optional selectBatchSize = Optional.empty();
private Optional fields = Optional.empty();
public B withSelectLimit(Optional selectLimit) {
this.selectLimit = selectLimit;
return self();
}
public B withSelectBatchSize(Optional selectBatchSize) {
this.selectBatchSize = selectBatchSize;
return self();
}
public B withSelectAfter(Optional startTuple) {
this.after = startTuple;
return self();
}
public B withFields(Optional fields) {
this.fields = fields;
return self();
}
}
/**
* Concrete Builder implementation for select cluster proxy operation options.
*/
protected static final class Builder extends AbstractBuilder {
@Override
Builder self() {
return this;
}
@Override
public CRUDSelectOptions build() {
return new CRUDSelectOptions(this);
}
}
}