io.tarantool.driver.DefaultTarantoolTupleFactory 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;
import io.tarantool.driver.api.TarantoolTupleFactory;
import io.tarantool.driver.api.tuple.TarantoolTuple;
import io.tarantool.driver.api.tuple.TarantoolTupleImpl;
import io.tarantool.driver.mappers.MessagePackMapper;
import java.util.Arrays;
import java.util.Collection;
/**
* Default implementation for {@link TarantoolTupleFactory}
*
* @author Alexey Kuzin
*/
public class DefaultTarantoolTupleFactory implements TarantoolTupleFactory {
private final MessagePackMapper mapper;
public DefaultTarantoolTupleFactory(MessagePackMapper mapper) {
this.mapper = mapper;
}
@Override
public TarantoolTuple create() {
return new TarantoolTupleImpl(mapper);
}
@Override
public TarantoolTuple create(Object... fields) {
return new TarantoolTupleImpl(Arrays.asList(fields), mapper);
}
@Override
public TarantoolTuple create(Collection> fields) {
return new TarantoolTupleImpl(fields, mapper);
}
}