Class AbstractPayloadSourceMethodProcessor

All Implemented Interfaces:
MethodArgumentResolver, MethodReturnValueHandler
Direct Known Subclasses:
Dom4jPayloadMethodProcessor, DomPayloadMethodProcessor, JDomPayloadMethodProcessor, SourcePayloadMethodProcessor, XomPayloadMethodProcessor

public abstract class AbstractPayloadSourceMethodProcessor extends AbstractPayloadMethodProcessor
Abstract base class for MethodArgumentResolver and MethodReturnValueHandler implementations based on Sources.
Since:
2.0
Author:
Arjen Poutsma
  • Constructor Details

    • AbstractPayloadSourceMethodProcessor

      public AbstractPayloadSourceMethodProcessor()
  • Method Details

    • resolveArgument

      public final Object resolveArgument(MessageContext messageContext, org.springframework.core.MethodParameter parameter) throws Exception
      Description copied from interface: MethodArgumentResolver
      Resolves the given parameter into a method argument.
      Parameters:
      messageContext - the current message context
      parameter - the parameter to resolve to an argument. This parameter must have previously been passed to the MethodArgumentResolver.supportsParameter(MethodParameter) method of this interface, which must have returned true.
      Returns:
      the resolved argument. May be null.
      Throws:
      Exception - in case of errors
    • resolveRequestPayloadArgument

      protected abstract Object resolveRequestPayloadArgument(org.springframework.core.MethodParameter parameter, Source requestPayload) throws Exception
      Resolves the given parameter, annotated with RequestPayload, into a method argument.
      Parameters:
      parameter - the parameter to resolve to an argument
      requestPayload - the request payload
      Returns:
      the resolved argument. May be null.
      Throws:
      Exception - in case of errors
    • handleReturnValue

      public final void handleReturnValue(MessageContext messageContext, org.springframework.core.MethodParameter returnType, Object returnValue) throws Exception
      Description copied from interface: MethodReturnValueHandler
      Handles the given return value.
      Parameters:
      messageContext - the current message context
      returnType - the return type to handle. This type must have previously been passed to the MethodReturnValueHandler.supportsReturnType(MethodParameter) method of this interface, which must have returned true.
      returnValue - the return value to handle
      Throws:
      Exception - in case of errors
    • createResponsePayload

      protected abstract Source createResponsePayload(org.springframework.core.MethodParameter returnType, Object returnValue) throws Exception
      Creates a response payload for the given return value.
      Parameters:
      returnType - the return type to handle
      returnValue - the return value to handle
      Returns:
      the response payload
      Throws:
      Exception - in case of errors