io.tarantool.driver.core.proxy.CRUDBatchOptions 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 options for proxy cluster batch operations
*
* @author Alexey Kuzin
*/
final class CRUDBatchOptions extends CRUDReturnOptions {
public static final String BATCH_STOP_ON_ERROR = "stop_on_error";
public static final String BATCH_ROLLBACK_ON_ERROR = "rollback_on_error";
private >
CRUDBatchOptions(AbstractBuilder builder) {
super(builder);
addOption(BATCH_STOP_ON_ERROR, builder.stopOnError);
addOption(BATCH_ROLLBACK_ON_ERROR, builder.rollbackOnError);
}
protected abstract static class AbstractBuilder>
extends CRUDReturnOptions.AbstractBuilder {
private Optional stopOnError = Optional.empty();
private Optional rollbackOnError = Optional.empty();
public B withStopOnError(Optional stopOnError) {
this.stopOnError = stopOnError;
return self();
}
public B withRollbackOnError(Optional rollbackOnError) {
this.rollbackOnError = rollbackOnError;
return self();
}
}
protected static final class Builder extends AbstractBuilder {
@Override
Builder self() {
return this;
}
@Override
public CRUDBatchOptions build() {
return new CRUDBatchOptions(this);
}
}
}