Class AbstractResultMapper<T>

    • Constructor Detail

      • AbstractResultMapper

        public AbstractResultMapper​(MessagePackValueMapper valueMapper,
                                    ValueConverter<org.msgpack.value.ArrayValue,​? extends T> resultConverter,
                                    Class<? extends T> resultClass)
        Basic constructor
        Parameters:
        valueMapper - MessagePack value-to-object mapper for result contents
        resultConverter - converter from MessagePack result array to result type
        resultClass - target result class
    • Method Detail

      • fromValue

        public <V extends org.msgpack.value.Value,​O> O fromValue​(V v,
                                                                       Class<O> targetClass)
                                                                throws MessagePackValueMapperException
        Description copied from interface: MessagePackValueMapper
        Create Java object out of its MessagePack representation. Converters will be checked to match the target object type.
        Specified by:
        fromValue in interface MessagePackValueMapper
        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

        public <V extends org.msgpack.value.Value,​O> void registerValueConverter​(org.msgpack.value.ValueType valueType,
                                                                                       Class<? extends O> objectClass,
                                                                                       ValueConverter<V,​? extends O> converter)
        Description copied from interface: MessagePackValueMapper
        Adds a MessagePack entity converter to this mappers instance.
        Specified by:
        registerValueConverter in interface MessagePackValueMapper
        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

        public <V extends org.msgpack.value.Value,​O> Optional<ValueConverter<V,​O>> getValueConverter​(org.msgpack.value.ValueType valueType,
                                                                                                                 Class<O> objectClass)
        Description copied from interface: MessagePackValueMapper
        Get a converter capable of converting from the source entity class to the target class
        Specified by:
        getValueConverter in interface MessagePackValueMapper
        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