
io.tarantool.driver.api.TarantoolResultImpl 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;
import io.tarantool.driver.mappers.ValueConverter;
import org.msgpack.value.ArrayValue;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.stream.Collectors;
/**
* Basic TarantoolResult implementation
*
* @param target result tuple type
* @author Alexey Kuzin
*/
public class TarantoolResultImpl implements TarantoolResult {
private List tuples;
public TarantoolResultImpl(ArrayValue value, ValueConverter tupleConverter) {
this.tuples = value.list().stream()
.map(v -> tupleConverter.fromValue(v.asArrayValue()))
.collect(Collectors.toList());
}
@Override
public int size() {
return this.tuples.size();
}
@Override
public boolean isEmpty() {
return this.tuples.isEmpty();
}
@Override
public boolean contains(Object o) {
return this.tuples.contains(o);
}
@Override
public Iterator iterator() {
return this.tuples.iterator();
}
@Override
public Object[] toArray() {
return this.tuples.toArray();
}
@Override
public T1[] toArray(T1[] a) {
return this.tuples.toArray(a);
}
@Override
public boolean add(T t) {
return this.tuples.add(t);
}
@Override
public boolean remove(Object o) {
return this.tuples.remove(o);
}
@Override
public boolean containsAll(Collection> c) {
return this.tuples.containsAll(c);
}
@Override
public boolean addAll(Collection extends T> c) {
return this.tuples.addAll(c);
}
@Override
public boolean addAll(int index, Collection extends T> c) {
return this.tuples.addAll(index, c);
}
@Override
public boolean removeAll(Collection> c) {
return this.tuples.removeAll(c);
}
@Override
public boolean retainAll(Collection> c) {
return this.tuples.retainAll(c);
}
@Override
public void clear() {
this.tuples.clear();
}
@Override
public T get(int index) {
return this.tuples.get(index);
}
@Override
public T set(int index, T element) {
return this.tuples.set(index, element);
}
@Override
public void add(int index, T element) {
this.tuples.add(index, element);
}
@Override
public T remove(int index) {
return this.tuples.remove(index);
}
@Override
public int indexOf(Object o) {
return this.tuples.indexOf(o);
}
@Override
public int lastIndexOf(Object o) {
return this.tuples.lastIndexOf(o);
}
@Override
public ListIterator listIterator() {
return this.tuples.listIterator();
}
@Override
public ListIterator listIterator(int index) {
return this.tuples.listIterator(index);
}
@Override
public List subList(int fromIndex, int toIndex) {
return this.tuples.subList(fromIndex, toIndex);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy