io.tarantool.driver.core.proxy.CRUDBaseOptions Maven / Gradle / Ivy
Show all versions of cartridge-driver Show documentation
package io.tarantool.driver.core.proxy;
import java.util.Optional;
/**
* This class is not part of the public API.
*
* Represent basic options for all cluster operations
*
* @author Alexey Kuzin
* @author Artyom Dubinin
*/
class CRUDBaseOptions extends CRUDAbstractOperationOptions {
public static final String TIMEOUT = "timeout";
protected >
CRUDBaseOptions(AbstractBuilder builder) {
addOption(TIMEOUT, builder.timeout);
}
/**
* Inheritable Builder for basic cluster proxy operation options.
*
* @see CRUDAbstractOperationOptions.AbstractBuilder
*/
protected abstract static class AbstractBuilder>
extends CRUDAbstractOperationOptions.AbstractBuilder {
protected Optional timeout = Optional.empty();
public B withTimeout(Optional timeout) {
this.timeout = timeout;
return self();
}
}
/**
* Concrete Builder implementation for basic cluster proxy operation options.
*/
protected static final class Builder
extends AbstractBuilder {
@Override
Builder self() {
return this;
}
@Override
public CRUDBaseOptions build() {
return new CRUDBaseOptions(this);
}
}
}