io.tarantool.driver.mappers.factories.ArrayValueToTarantoolTupleResultMapperFactory 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.mappers.factories;
import io.tarantool.driver.api.metadata.TarantoolSpaceMetadata;
import io.tarantool.driver.api.tuple.TarantoolTuple;
import io.tarantool.driver.mappers.MessagePackMapper;
import io.tarantool.driver.mappers.MessagePackValueMapper;
import io.tarantool.driver.mappers.TarantoolResultMapper;
import io.tarantool.driver.mappers.converters.value.ArrayValueToTarantoolTupleConverter;
import io.tarantool.driver.mappers.converters.value.ArrayValueToTarantoolTupleResultConverter;
import org.msgpack.value.ValueType;
/**
* Factory for {@link TarantoolResultMapper} instances used for handling results with tuples of array type
*
* @author Alexey Kuzin
* @author Artyom Dubinin
*/
public class ArrayValueToTarantoolTupleResultMapperFactory
extends ArrayValueToTarantoolResultMapperFactory {
private final MessagePackMapper messagePackMapper;
/**
* Basic constructor
*/
public ArrayValueToTarantoolTupleResultMapperFactory() {
this(DefaultMessagePackMapperFactory.getInstance().emptyMapper());
}
/**
* Basic constructor with mapper
*
* @param messagePackMapper MessagePack-to-object mapper for tuple contents
*/
public ArrayValueToTarantoolTupleResultMapperFactory(MessagePackMapper messagePackMapper) {
super();
this.messagePackMapper = messagePackMapper;
}
public TarantoolResultMapper withArrayValueToTarantoolTupleResultConverter(
MessagePackMapper messagePackMapper) {
return withArrayValueToTarantoolTupleResultConverter(
new ArrayValueToTarantoolTupleConverter(messagePackMapper, null));
}
public TarantoolResultMapper withArrayValueToTarantoolTupleResultConverter(
MessagePackMapper messagePackMapper, TarantoolSpaceMetadata spaceMetadata) {
return withArrayValueToTarantoolTupleResultConverter(
new ArrayValueToTarantoolTupleConverter(messagePackMapper, spaceMetadata));
}
public TarantoolResultMapper withArrayValueToTarantoolTupleResultConverter(
ArrayValueToTarantoolTupleConverter tupleConverter) {
return withConverterWithoutTargetClass(
messagePackMapper.copy(),
ValueType.ARRAY,
new ArrayValueToTarantoolTupleResultConverter(tupleConverter)
);
}
public TarantoolResultMapper withArrayValueToTarantoolTupleResultConverter(
MessagePackValueMapper valueMapper,
ArrayValueToTarantoolTupleConverter tupleConverter) {
return withConverterWithoutTargetClass(
valueMapper,
ValueType.ARRAY,
new ArrayValueToTarantoolTupleResultConverter(tupleConverter)
);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy