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