Class SimpleMethodEndpointMapping

java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.core.Ordered, EndpointMapping

public class SimpleMethodEndpointMapping extends AbstractMethodEndpointMapping<String> implements org.springframework.beans.factory.InitializingBean
Simple subclass of AbstractMethodEndpointMapping that maps from the local name of the request payload to methods. Endpoint beans are registered using the endpoints property; the endpoint methods that start with methodPrefix and end with methodSuffix will be registered.

Endpoints typically have the following form:

 public class MyEndpoint{

          public Source handleMyMessage(Source source) {
                 ...
          }
 }
 
This method will handle any message that has the MyMessage as a payload root local name.
Since:
1.0.0
Author:
Arjen Poutsma
See Also:
  • Field Details

  • Constructor Details

    • SimpleMethodEndpointMapping

      public SimpleMethodEndpointMapping()
  • Method Details

    • getEndpoints

      public Object[] getEndpoints()
    • setEndpoints

      public void setEndpoints(Object[] endpoints)
      Sets the endpoints. The endpoint methods that start with methodPrefix and end with methodSuffix will be registered.
    • getMethodPrefix

      public String getMethodPrefix()
      Returns the method prefix.
    • setMethodPrefix

      public void setMethodPrefix(String methodPrefix)
      Sets the method prefix. All methods with names starting with this string will be registered. Default is "handle".
      See Also:
    • getMethodSuffix

      public String getMethodSuffix()
      Returns the method suffix.
    • setMethodSuffix

      public void setMethodSuffix(String methodSuffix)
      Sets the method suffix. All methods with names ending with this string will be registered. Default is "" (i.e. no suffix).
      See Also:
    • afterPropertiesSet

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

      protected String getLookupKeyForMethod(Method method)
      Returns the name of the given method, with the prefix and suffix stripped off.
      Overrides:
      getLookupKeyForMethod in class AbstractMethodEndpointMapping<String>
      Parameters:
      method - the method
      Returns:
      a registration key, or null if the method is not to be registered
      See Also:
    • getLookupKeyForMessage

      protected String getLookupKeyForMessage(MessageContext messageContext) throws TransformerException
      Returns the local part of the payload root element of the request.
      Specified by:
      getLookupKeyForMessage in class AbstractMethodEndpointMapping<String>
      Returns:
      the registration keys
      Throws:
      TransformerException