Package io.tarantool.driver.mappers
Interface MessagePackValueMapper
-
- All Known Subinterfaces:
MessagePackMapper
- All Known Implementing Classes:
AbstractResultMapper,CallResultMapper,DefaultMessagePackMapper,DefaultMultiValueResultMapper,DefaultSingleValueResultMapper,TarantoolResultMapper
public interface MessagePackValueMapperBasic interface for collection of generic converters between MessagePack entities and Java objects. Value converters must be added using theregisterValueConverter(ValueType, Class, ValueConverter)method
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <V extends org.msgpack.value.Value,O>
OfromValue(V v)Create Java object out of its MessagePack representation.<V extends org.msgpack.value.Value,O>
OfromValue(V v, Class<O> targetClass)Create Java object out of its MessagePack representation.<V extends org.msgpack.value.Value,O>
Optional<ValueConverter<V,O>>getValueConverter(org.msgpack.value.ValueType valueType, Class<O> objectClass)Get a converter capable of converting from the source entity class to the target class<V extends org.msgpack.value.Value,O>
voidregisterValueConverter(org.msgpack.value.ValueType valueType, Class<? extends O> objectClass, ValueConverter<V,? extends O> converter)Adds a MessagePack entity converter to this mappers instance.
-
-
-
Method Detail
-
fromValue
<V extends org.msgpack.value.Value,O> O fromValue(V v) throws MessagePackValueMapperExceptionCreate Java object out of its MessagePack representation.- Type Parameters:
V- source MessagePack entity typeO- target object type- Parameters:
v- MessagePack entity- Returns:
- Java object
- Throws:
MessagePackValueMapperException- if the corresponding conversion cannot be performed
-
fromValue
<V extends org.msgpack.value.Value,O> O fromValue(V v, Class<O> targetClass) throws MessagePackValueMapperExceptionCreate Java object out of its MessagePack representation. Converters will be checked to match the target object type.- Type Parameters:
V- source MessagePack entity typeO- target object type- Parameters:
v- MessagePack entitytargetClass- Java object class- Returns:
- Java object
- Throws:
MessagePackValueMapperException- if the corresponding conversion cannot be performed
-
registerValueConverter
<V extends org.msgpack.value.Value,O> void registerValueConverter(org.msgpack.value.ValueType valueType, Class<? extends O> objectClass, ValueConverter<V,? extends O> converter)Adds a MessagePack entity converter to this mappers instance.- Type Parameters:
V- MessagePack's entity type that the converter accepts and/or returnsO- java object's type that the converter accepts and/or returns- Parameters:
valueType- MessagePack source typeobjectClass- target object classconverter- object-to-entity converter- See Also:
ValueConverter
-
getValueConverter
<V extends org.msgpack.value.Value,O> Optional<ValueConverter<V,O>> getValueConverter(org.msgpack.value.ValueType valueType, Class<O> objectClass)
Get a converter capable of converting from the source entity class to the target class- Type Parameters:
V- MessagePack's entity type that the converter accepts and/or returnsO- java object's type that the converter accepts and/or returns- Parameters:
valueType- MessagePack source typeobjectClass- the target conversion class- Returns:
- a nullable converter instance wrapped in
Optional
-
-