Class DefaultMethodEndpointAdapter

All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.InitializingBean, EndpointAdapter

public class DefaultMethodEndpointAdapter extends AbstractMethodEndpointAdapter implements org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.InitializingBean
Default extension of AbstractMethodEndpointAdapter with support for pluggable argument resolvers and return value handlers.
Since:
2.0
Author:
Arjen Poutsma
  • Constructor Details

    • DefaultMethodEndpointAdapter

      public DefaultMethodEndpointAdapter()
  • Method Details

    • getMethodArgumentResolvers

      public List<MethodArgumentResolver> getMethodArgumentResolvers()
      Returns the list of MethodArgumentResolvers to use.
    • setMethodArgumentResolvers

      public void setMethodArgumentResolvers(List<MethodArgumentResolver> methodArgumentResolvers)
      Sets the list of MethodArgumentResolvers to use.
    • getCustomMethodArgumentResolvers

      public List<MethodArgumentResolver> getCustomMethodArgumentResolvers()
      Returns the custom argument resolvers.
    • setCustomMethodArgumentResolvers

      public void setCustomMethodArgumentResolvers(List<MethodArgumentResolver> customMethodArgumentResolvers)
      Sets the custom handlers for method arguments. Custom handlers are ordered after built-in ones. To override the built-in support for return value handling use setMethodArgumentResolvers(List).
    • getMethodReturnValueHandlers

      public List<MethodReturnValueHandler> getMethodReturnValueHandlers()
      Returns the list of MethodReturnValueHandlers to use.
    • setMethodReturnValueHandlers

      public void setMethodReturnValueHandlers(List<MethodReturnValueHandler> methodReturnValueHandlers)
      Sets the list of MethodReturnValueHandlers to use.
    • getCustomMethodReturnValueHandlers

      public List<MethodReturnValueHandler> getCustomMethodReturnValueHandlers()
      Returns the custom return value handlers.
    • setCustomMethodReturnValueHandlers

      public void setCustomMethodReturnValueHandlers(List<MethodReturnValueHandler> customMethodReturnValueHandlers)
      Sets the handlers for custom return value types. Custom handlers are ordered after built-in ones. To override the built-in support for return value handling use setMethodReturnValueHandlers(List).
    • setBeanClassLoader

      public void setBeanClassLoader(ClassLoader classLoader)
      Specified by:
      setBeanClassLoader in interface org.springframework.beans.factory.BeanClassLoaderAware
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • initDefaultStrategies

      protected void initDefaultStrategies()
      Initialize the default implementations for the adapter's strategies.
    • supportsInternal

      protected boolean supportsInternal(MethodEndpoint methodEndpoint)
      Description copied from class: AbstractMethodEndpointAdapter
      Given a method endpoint, return whether or not this adapter can support it.
      Specified by:
      supportsInternal in class AbstractMethodEndpointAdapter
      Parameters:
      methodEndpoint - method endpoint to check
      Returns:
      whether or not this adapter can adapt the given method
    • invokeInternal

      protected final void invokeInternal(MessageContext messageContext, MethodEndpoint methodEndpoint) throws Exception
      Description copied from class: AbstractMethodEndpointAdapter
      Use the given method endpoint to handle the request.
      Specified by:
      invokeInternal in class AbstractMethodEndpointAdapter
      Parameters:
      messageContext - the current message context
      methodEndpoint - the method endpoint to use
      Throws:
      Exception - in case of errors
    • getMethodArguments

      protected Object[] getMethodArguments(MessageContext messageContext, MethodEndpoint methodEndpoint) throws Exception
      Returns the argument array for the given method endpoint.

      This implementation iterates over the set argument resolvers to resolve each argument.

      Parameters:
      messageContext - the current message context
      methodEndpoint - the method endpoint to get arguments for
      Returns:
      the arguments
      Throws:
      Exception - in case of errors
    • handleMethodReturnValue

      protected void handleMethodReturnValue(MessageContext messageContext, Object returnValue, MethodEndpoint methodEndpoint) throws Exception
      Handle the return value for the given method endpoint.

      This implementation iterates over the set setMethodReturnValueHandlers(java.util.List) return value handlers} to resolve the return value.

      Parameters:
      messageContext - the current message context
      returnValue - the return value
      methodEndpoint - the method endpoint to get arguments for
      Throws:
      Exception - in case of errors