org.apache.camel.component.bean
Class MethodInfo

java.lang.Object
  extended by org.apache.camel.component.bean.MethodInfo

public class MethodInfo
extends Object

Information about a method to be used for invocation.

Version:

Constructor Summary
MethodInfo(CamelContext camelContext, Class<?> type, Method method, List<ParameterInfo> parameters, List<ParameterInfo> bodyParameters, boolean hasCustomAnnotation, boolean hasHandlerAnnotation)
           
 
Method Summary
protected  void addTypeAndSuperTypes(Class<?> type, List<Class<?>> result)
          Adds the current class and all of its base classes (apart from Object to the given list
 boolean bodyParameterMatches(Class<?> bodyType)
           
 MethodInvocation createMethodInvocation(Object pojo, Exchange exchange)
           
protected  Expression createParametersExpression()
           
protected  Pattern findOneWayAnnotation(List<Class<?>> classes)
          Finds the first annotation on the given list of classes
protected  Pattern findOneWayAnnotation(Method method)
          Finds the oneway annotation in priority order; look for method level annotations first, then the class level annotations, then super class annotations then interface annotations
protected  Pattern findOneWayAnnotationOnMethod(List<Class<?>> classes, Method method)
          Finds the first annotation on the base methods defined in the list of classes
 List<ParameterInfo> getBodyParameters()
           
 Class<?> getBodyParameterType()
           
 Method getMethod()
           
 List<ParameterInfo> getParameters()
           
 Expression getParametersExpression()
           
 ExchangePattern getPattern()
          Returns the ExchangePattern that should be used when invoking this method.
protected  Pattern getPatternAnnotation(AnnotatedElement annotatedElement)
          Returns the pattern annotation on the given annotated element; either as a direct annotation or on an annotation which is also annotated
protected  Pattern getPatternAnnotation(AnnotatedElement annotatedElement, int depth)
          Returns the pattern annotation on the given annotated element; either as a direct annotation or on an annotation which is also annotated
 Class<?> getType()
           
 boolean hasBodyParameter()
           
 boolean hasCustomAnnotation()
           
protected  boolean hasExceptionParameter()
           
 boolean hasHandlerAnnotation()
           
protected  Object invoke(Method mth, Object pojo, Object[] arguments, Exchange exchange)
           
 boolean isReturnTypeVoid()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MethodInfo

public MethodInfo(CamelContext camelContext,
                  Class<?> type,
                  Method method,
                  List<ParameterInfo> parameters,
                  List<ParameterInfo> bodyParameters,
                  boolean hasCustomAnnotation,
                  boolean hasHandlerAnnotation)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

createMethodInvocation

public MethodInvocation createMethodInvocation(Object pojo,
                                               Exchange exchange)

getType

public Class<?> getType()

getMethod

public Method getMethod()

getPattern

public ExchangePattern getPattern()
Returns the ExchangePattern that should be used when invoking this method. This value defaults to ExchangePattern.InOut unless some Pattern annotation is used to override the message exchange pattern.

Returns:
the exchange pattern to use for invoking this method.

getParametersExpression

public Expression getParametersExpression()

getBodyParameters

public List<ParameterInfo> getBodyParameters()

getBodyParameterType

public Class<?> getBodyParameterType()

bodyParameterMatches

public boolean bodyParameterMatches(Class<?> bodyType)

getParameters

public List<ParameterInfo> getParameters()

hasBodyParameter

public boolean hasBodyParameter()

hasCustomAnnotation

public boolean hasCustomAnnotation()

hasHandlerAnnotation

public boolean hasHandlerAnnotation()

isReturnTypeVoid

public boolean isReturnTypeVoid()

invoke

protected Object invoke(Method mth,
                        Object pojo,
                        Object[] arguments,
                        Exchange exchange)
                 throws IllegalAccessException,
                        InvocationTargetException
Throws:
IllegalAccessException
InvocationTargetException

createParametersExpression

protected Expression createParametersExpression()

findOneWayAnnotation

protected Pattern findOneWayAnnotation(Method method)
Finds the oneway annotation in priority order; look for method level annotations first, then the class level annotations, then super class annotations then interface annotations

Parameters:
method - the method on which to search
Returns:
the first matching annotation or none if it is not available

getPatternAnnotation

protected Pattern getPatternAnnotation(AnnotatedElement annotatedElement)
Returns the pattern annotation on the given annotated element; either as a direct annotation or on an annotation which is also annotated

Parameters:
annotatedElement - the element to look for the annotation
Returns:
the first matching annotation or null if none could be found

getPatternAnnotation

protected Pattern getPatternAnnotation(AnnotatedElement annotatedElement,
                                       int depth)
Returns the pattern annotation on the given annotated element; either as a direct annotation or on an annotation which is also annotated

Parameters:
annotatedElement - the element to look for the annotation
depth - the current depth
Returns:
the first matching annotation or null if none could be found

addTypeAndSuperTypes

protected void addTypeAndSuperTypes(Class<?> type,
                                    List<Class<?>> result)
Adds the current class and all of its base classes (apart from Object to the given list


findOneWayAnnotationOnMethod

protected Pattern findOneWayAnnotationOnMethod(List<Class<?>> classes,
                                               Method method)
Finds the first annotation on the base methods defined in the list of classes


findOneWayAnnotation

protected Pattern findOneWayAnnotation(List<Class<?>> classes)
Finds the first annotation on the given list of classes


hasExceptionParameter

protected boolean hasExceptionParameter()


Apache CAMEL