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

io.tarantool.driver.protocol.NotEmptyTarantoolResponseBody 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.protocol;

import org.msgpack.value.Value;

/**
 * Represents non-empty body from a map with one key and the actual data as value
 *
 * @author Alexey Kuzin
 */
public class NotEmptyTarantoolResponseBody implements TarantoolResponseBody {
    private final TarantoolResponseBodyType responseBodyType;
    private final Value data;

    /**
     * Basic constructor.
     * @param code first key in the body MP_MAP value
     * @param data the data (of type MP_OBJECT)
     * @throws TarantoolProtocolException if the specified code doesn't correspond to a valid
     * {@link TarantoolResponseBodyType}
     */
    public NotEmptyTarantoolResponseBody(int code, Value data) throws TarantoolProtocolException {
        this.responseBodyType = TarantoolResponseBodyType.fromCode(code);
        this.data = data;
    }

    @Override
    public TarantoolResponseBodyType getResponseBodyType() {
        return responseBodyType;
    }

    @Override
    public Value getData() {
        return data;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy