Class DefaultResponseMapper

java.lang.Object
io.fluxzero.sdk.tracking.handling.DefaultResponseMapper
All Implemented Interfaces:
ResponseMapper

public class DefaultResponseMapper extends Object implements ResponseMapper
A default implementation of the ResponseMapper interface that simply wraps the response in a Message
  • Constructor Details

    • DefaultResponseMapper

      public DefaultResponseMapper()
  • Method Details

    • map

      public Message map(Object response)
      Description copied from interface: ResponseMapper
      Maps the given response object to a Message. The response may be a plain object or a Message.
      Specified by:
      map in interface ResponseMapper
      Parameters:
      response - the response object to be mapped
      Returns:
      a Message representing the response
    • mapPayload

      public Object mapPayload(Object response)
      Description copied from interface: ResponseMapper
      Maps a synchronously completed handler result to the value returned by the gateway.

      The default obtains the payload from ResponseMapper.map(Object). Implementations may override this method to avoid creating an intermediate Message, but the returned value must be identical to map(response).getPayload().

      Specified by:
      mapPayload in interface ResponseMapper
      Parameters:
      response - the value returned by the handler
      Returns:
      the payload to return from the gateway
    • map

      public Message map(Object response, Metadata metadata)
      Description copied from interface: ResponseMapper
      Maps the given response object and metadata to a Message.
      Specified by:
      map in interface ResponseMapper
      Parameters:
      response - the response object to be transformed
      metadata - optional metadata to include in the message
      Returns:
      a Message representing the response and metadata