Class AbstractMethodEndpointMapping<T>

java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.ws.server.endpoint.mapping.AbstractEndpointMapping
org.springframework.ws.server.endpoint.mapping.AbstractMethodEndpointMapping<T>
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.core.Ordered, EndpointMapping
Direct Known Subclasses:
AbstractAnnotationMethodEndpointMapping, SimpleMethodEndpointMapping

public abstract class AbstractMethodEndpointMapping<T> extends AbstractEndpointMapping
Abstract base class for MethodEndpoint mappings.

Subclasses typically implement BeanPostProcessor to look for beans that qualify as endpoint. The methods of this bean are then registered under a specific key with registerEndpoint(Object, MethodEndpoint).

Since:
1.0.0
Author:
Arjen Poutsma
  • Constructor Details

    • AbstractMethodEndpointMapping

      public AbstractMethodEndpointMapping()
  • Method Details

    • getEndpointInternal

      protected Object getEndpointInternal(MessageContext messageContext) throws Exception
      Lookup an endpoint for the given message. The extraction of the endpoint key is delegated to the concrete subclass.
      Specified by:
      getEndpointInternal in class AbstractEndpointMapping
      Returns:
      the looked up endpoint, or null
      Throws:
      Exception - if there is an error
      See Also:
    • getLookupKeyForMessage

      protected abstract T getLookupKeyForMessage(MessageContext messageContext) throws Exception
      Returns the endpoint keys for the given message context.
      Returns:
      the registration keys
      Throws:
      Exception
    • lookupEndpoint

      protected MethodEndpoint lookupEndpoint(T key)
      Looks up an endpoint instance for the given keys. All keys are tried in order.
      Parameters:
      key - key the beans are mapped to
      Returns:
      the associated endpoint instance, or null if not found
    • registerEndpoint

      protected void registerEndpoint(T key, MethodEndpoint endpoint) throws org.springframework.beans.BeansException
      Register the given endpoint instance under the key.
      Parameters:
      key - the lookup key
      endpoint - the method endpoint instance
      Throws:
      org.springframework.beans.BeansException - if the endpoint could not be registered
    • registerMethods

      protected void registerMethods(Object endpoint)
      Helper method that registers the methods of the given bean. This method iterates over the methods of the bean, and calls getLookupKeyForMethod(Method) for each. If this returns a string, the method is registered using registerEndpoint(Object, MethodEndpoint).
      See Also:
    • registerMethods

      protected void registerMethods(String beanName)
      Helper method that registers the methods of the given class. This method iterates over the methods of the class, and calls getLookupKeyForMethod(Method) for each. If this returns a string, the method is registered using registerEndpoint(Object, MethodEndpoint).
      See Also:
    • getLookupKeyForMethod

      protected T getLookupKeyForMethod(Method method)
      Returns the endpoint key for the given method. Returns null if the method is not to be registered, which is the default.
      Parameters:
      method - the method
      Returns:
      a registration key, or null if the method is not to be registered
      See Also:
    • getLookupKeysForMethod

      protected List<T> getLookupKeysForMethod(Method method)
      Returns the endpoint keys for the given method. Should return an empty array if the method is not to be registered. The default delegates to getLookupKeysForMethod(Method).
      Parameters:
      method - the method
      Returns:
      a list of registration keys
      Since:
      2.2
    • getEndpointClass

      protected Class<?> getEndpointClass(Object endpoint)
      Return the class or interface to use for method reflection.

      Default implementation delegates to AopUtils.getTargetClass(Object).

      Parameters:
      endpoint - the bean instance (might be an AOP proxy)
      Returns:
      the bean class to expose