All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.tarantool.driver.DefaultTarantoolTupleFactory Maven / Gradle / Ivy

Go to download

Tarantool Cartridge driver for Tarantool versions 1.10+ based on Netty framework

There is a newer version: 0.14.0
Show newest version
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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy