Interface MessagePackValueMapper

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <V extends org.msgpack.value.Value,​O>
      O
      fromValue​(V v)
      Create Java object out of its MessagePack representation.
      <V extends org.msgpack.value.Value,​O>
      O
      fromValue​(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>
      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.
    • Method Detail

      • fromValue

        <V extends org.msgpack.value.Value,​O> O fromValue​(V v)
                                                         throws MessagePackValueMapperException
        Create Java object out of its MessagePack representation.
        Type Parameters:
        V - source MessagePack entity type
        O - 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 MessagePackValueMapperException
        Create Java object out of its MessagePack representation. Converters will be checked to match the target object type.
        Type Parameters:
        V - source MessagePack entity type
        O - target object type
        Parameters:
        v - MessagePack entity
        targetClass - 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 returns
        O - java object's type that the converter accepts and/or returns
        Parameters:
        valueType - MessagePack source type
        objectClass - target object class
        converter - 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 returns
        O - java object's type that the converter accepts and/or returns
        Parameters:
        valueType - MessagePack source type
        objectClass - the target conversion class
        Returns:
        a nullable converter instance wrapped in Optional