Class DefaultMessagePackMapper

    • Constructor Detail

      • DefaultMessagePackMapper

        public DefaultMessagePackMapper()
        Basic constructor
      • DefaultMessagePackMapper

        public DefaultMessagePackMapper​(DefaultMessagePackMapper mapper)
        Copying constructor
        Parameters:
        mapper - another mapper instance
    • Method Detail

      • toValue

        public <V extends org.msgpack.value.Value,​O> V toValue​(O o)
        Description copied from interface: MessagePackObjectMapper
        Create MessagePack entity representation for an object.
        Specified by:
        toValue in interface MessagePackObjectMapper
        Type Parameters:
        V - the target MessagePack entity type
        O - the source object type
        Parameters:
        o - an object to be converted
        Returns:
        instance of MessagePack Value
      • fromValue

        public <V extends org.msgpack.value.Value,​O> O fromValue​(V v)
        Description copied from interface: MessagePackValueMapper
        Create Java object out of its MessagePack representation.
        Specified by:
        fromValue in interface MessagePackValueMapper
        Type Parameters:
        V - source MessagePack entity type
        O - target object type
        Parameters:
        v - MessagePack entity
        Returns:
        Java object
      • fromValue

        public <V extends org.msgpack.value.Value,​O> O fromValue​(V v,
                                                                       Class<O> targetClass)
        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
      • registerValueConverter

        public <V extends org.msgpack.value.Value,​O> void registerValueConverter​(org.msgpack.value.ValueType valueType,
                                                                                       ValueConverter<V,​? extends O> converter)
        Perform ValueConverter converter registration. The target object class for registration is determined automatically
        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
        converter - entity-to-object converter
        See Also:
        ValueConverter
      • 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> targetClass)
        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
        targetClass - the target conversion class
        Returns:
        a nullable converter instance wrapped in Optional
      • registerObjectConverter

        public <V extends org.msgpack.value.Value,​O> void registerObjectConverter​(ObjectConverter<O,​V> converter)
        Perform ObjectConverter converter registration. The source object class and target entity class for registration are determined automatically
        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:
        converter - object-to-entity converter
        See Also:
        ObjectConverter
      • registerObjectConverter

        public <V extends org.msgpack.value.Value,​O> void registerObjectConverter​(Class<? extends O> objectClass,
                                                                                        ObjectConverter<O,​V> converter)
        Adds a Java object converter to this mappers instance. The target value class for registration is determined automatically
        Type Parameters:
        V - the target MessagePack entity type
        O - the source object type
        Parameters:
        objectClass - object class to register the converter for
        converter - entity-to-object converter
        See Also:
        ObjectConverter
      • registerObjectConverter

        public <V extends org.msgpack.value.Value,​O> void registerObjectConverter​(Class<? extends O> objectClass,
                                                                                        Class<V> valueClass,
                                                                                        ObjectConverter<O,​V> converter)
        Description copied from interface: MessagePackObjectMapper
        Adds a Java object converter to this mappers instance
        Specified by:
        registerObjectConverter in interface MessagePackObjectMapper
        Type Parameters:
        V - the target MessagePack entity type
        O - the source object type
        Parameters:
        objectClass - source object class
        valueClass - target value class
        converter - entity-to-object converter
        See Also:
        ObjectConverter