io.tarantool.driver.mappers.converters.object.DefaultLongArrayToArrayValueConverter 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.converters.object;
import io.tarantool.driver.mappers.converters.ObjectConverter;
import org.msgpack.value.ArrayValue;
import org.msgpack.value.Value;
import org.msgpack.value.ValueFactory;
import org.msgpack.value.impl.ImmutableLongValueImpl;
import java.util.Arrays;
/**
* Default {@code long[]} to {@link ArrayValue} converter
*
* @author Anastasiia Romanova
*/
public class DefaultLongArrayToArrayValueConverter implements ObjectConverter {
private static final long serialVersionUID = 20221022L;
@Override
public ArrayValue toValue(long[] object) {
return ValueFactory.newArray(toNumberValueArray(object), true);
}
private Value[] toNumberValueArray(long[] object) {
return Arrays.stream(object).mapToObj(ImmutableLongValueImpl::new).toArray(Value[]::new);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy