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

io.tarantool.driver.api.tuple.TarantoolNullField 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.api.tuple;

import io.tarantool.driver.mappers.MessagePackObjectMapper;
import io.tarantool.driver.mappers.MessagePackValueMapper;
import org.msgpack.value.Value;
import org.msgpack.value.ValueFactory;

import java.util.Objects;

/**
 * Represents a field with empty value which serializes to {@code msgpack.NULL}
 *
 * @author Alexey Kuzin
 */
public final class TarantoolNullField implements TarantoolField {

    @Override
    public Value toMessagePackValue(MessagePackObjectMapper mapper) {
        return ValueFactory.newNil();
    }

    @Override
    public  O getValue(Class targetClass, MessagePackValueMapper mapper) {
        return null;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        return o instanceof TarantoolNullField;
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(this);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy