org.tarantool.TarantoolGenericBatchConnection16Impl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of connector Show documentation
Show all versions of connector Show documentation
Tarantool client for java
package org.tarantool;
import java.nio.channels.SocketChannel;
import java.util.List;
public class TarantoolGenericBatchConnection16Impl extends TarantoolBatchConnection16Impl implements TarantoolGenericBatchConnection16 {
protected final Mapper mapper;
public TarantoolGenericBatchConnection16Impl(SocketChannel channel, Mapper mapper) {
super(channel);
this.mapper = mapper;
}
protected Holder wrap(final Class clz, final List result) {
return new Holder() {
@Override
public T get() {
if (batch != null) {
throw new IllegalStateException("You should end batch first");
}
return mapper.toObject(clz, result);
}
};
}
@Override
public Holder select(final Class clz, int space, int index, Object key, int offset, int limit, int iterator) {
return wrap(clz, super.select(space, index, key, offset, limit, iterator));
}
@Override
public Holder insert(Class clz, int space, Object tuple) {
return wrap(clz, super.insert(space, mapper.toTuple(tuple)));
}
@Override
public Holder replace(Class clz, int space, Object tuple) {
return wrap(clz, super.replace(space, mapper.toTuple(tuple)));
}
@Override
public Holder update(Class clz, int space, Object key, Object... args) {
return wrap(clz, super.update(space, key, mapper.toTuples(args)));
}
@Override
public Holder delete(Class clz, int space, Object key) {
return wrap(clz, super.delete(space, key));
}
@Override
public Holder call(Class clz, String function, Object... args) {
return wrap(clz, super.call(function, mapper.toTuples(args)));
}
@Override
public Holder eval(Class clz, String expression, Object... args) {
return wrap(clz, super.eval(expression, mapper.toTuples(args)));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy