Interface PayloadFactory


  • public interface PayloadFactory
    A PayloadFactory creates new instances of Payload.

    An instance of Payload is linked to a corresponding MediaType, therefore implementations of this factory should be media type specific, such as XmlProviderFactory.

    Author:
    Juliano Boesel Mohr
    • Method Detail

      • newInstance

        <T> Payload<T> newInstance​(String content,
                                   Class<T> type)
        Creates a new instance of Payload out of a serialized, raw format.
        Type Parameters:
        T - the object type that represents the new Payload
        Parameters:
        content - the raw, serialized, Payload content
        type - the Class to explicitly define this Payload type
        Returns:
        a new instance of Payload
      • newInstance

        <T> Payload<T> newInstance​(T object)
        Creates a new instance of Payload for a given object.
        Type Parameters:
        T - the object type that represents the new Payload
        Parameters:
        object - the object represented by this Payload
        Returns:
        a new instance of Payload