Package org.apache.camel.component.bean
Class MethodInfo
- java.lang.Object
-
- org.apache.camel.component.bean.MethodInfo
-
public class MethodInfo extends Object
Information about a method to be used for invocation.
-
-
Constructor Summary
Constructors Constructor Description MethodInfo(org.apache.camel.CamelContext camelContext, Class<?> type, Method method, List<org.apache.camel.component.bean.ParameterInfo> parameters, List<org.apache.camel.component.bean.ParameterInfo> bodyParameters, boolean hasCustomAnnotation, boolean hasHandlerAnnotation)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddTypeAndSuperTypes(Class<?> type, List<Class<?>> result)Adds the current class and all of its base classes (apart fromObjectto the given listbooleanbodyParameterMatches(Class<?> bodyType)MethodInvocationcreateMethodInvocation(Object pojo, boolean hasParameters, org.apache.camel.Exchange exchange)protected org.apache.camel.Expression[]createParameterExpressions()protected org.apache.camel.ExpressioncreateParametersExpression()protected org.apache.camel.PatternfindOneWayAnnotation(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 annotationsprotected org.apache.camel.PatternfindOneWayAnnotation(List<Class<?>> classes)Finds the first annotation on the given list of classesprotected org.apache.camel.PatternfindOneWayAnnotationOnMethod(List<Class<?>> classes, Method method)Finds the first annotation on the base methods defined in the list of classesList<org.apache.camel.component.bean.ParameterInfo>getBodyParameters()Class<?>getBodyParameterType()MethodgetMethod()List<org.apache.camel.component.bean.ParameterInfo>getParameters()org.apache.camel.ExpressiongetParametersExpression()org.apache.camel.ExchangePatterngetPattern()Returns theExchangePatternthat should be used when invoking this method.protected org.apache.camel.PatterngetPatternAnnotation(AnnotatedElement annotatedElement)Returns the pattern annotation on the given annotated element; either as a direct annotation or on an annotation which is also annotatedprotected org.apache.camel.PatterngetPatternAnnotation(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 annotatedClass<?>getType()booleanhasBodyParameter()booleanhasCustomAnnotation()protected booleanhasExceptionParameter()booleanhasHandlerAnnotation()booleanhasParameters()protected Objectinvoke(Method mth, Object pojo, Object[] arguments, org.apache.camel.Exchange exchange)booleanisCovariantWith(MethodInfo method)Returns true if this method is covariant with the specified method (this method may above or below the specified method in the class hierarchy)booleanisReturnTypeVoid()booleanisStaticMethod()StringtoString()
-
-
-
Method Detail
-
createMethodInvocation
public MethodInvocation createMethodInvocation(Object pojo, boolean hasParameters, org.apache.camel.Exchange exchange)
-
getType
public Class<?> getType()
-
getMethod
public Method getMethod()
-
getPattern
public org.apache.camel.ExchangePattern getPattern()
Returns theExchangePatternthat should be used when invoking this method. This value defaults toExchangePattern.InOutunless somePatternannotation is used to override the message exchange pattern.- Returns:
- the exchange pattern to use for invoking this method.
-
getParametersExpression
public org.apache.camel.Expression getParametersExpression()
-
getBodyParameters
public List<org.apache.camel.component.bean.ParameterInfo> getBodyParameters()
-
getBodyParameterType
public Class<?> getBodyParameterType()
-
bodyParameterMatches
public boolean bodyParameterMatches(Class<?> bodyType)
-
getParameters
public List<org.apache.camel.component.bean.ParameterInfo> getParameters()
-
hasBodyParameter
public boolean hasBodyParameter()
-
hasCustomAnnotation
public boolean hasCustomAnnotation()
-
hasHandlerAnnotation
public boolean hasHandlerAnnotation()
-
hasParameters
public boolean hasParameters()
-
isReturnTypeVoid
public boolean isReturnTypeVoid()
-
isStaticMethod
public boolean isStaticMethod()
-
isCovariantWith
public boolean isCovariantWith(MethodInfo method)
Returns true if this method is covariant with the specified method (this method may above or below the specified method in the class hierarchy)
-
invoke
protected Object invoke(Method mth, Object pojo, Object[] arguments, org.apache.camel.Exchange exchange) throws InvocationTargetException
- Throws:
InvocationTargetException
-
createParameterExpressions
protected org.apache.camel.Expression[] createParameterExpressions()
-
createParametersExpression
protected org.apache.camel.Expression createParametersExpression()
-
findOneWayAnnotation
protected org.apache.camel.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 org.apache.camel.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 org.apache.camel.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 annotationdepth- 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 fromObjectto the given list
-
findOneWayAnnotationOnMethod
protected org.apache.camel.Pattern findOneWayAnnotationOnMethod(List<Class<?>> classes, Method method)
Finds the first annotation on the base methods defined in the list of classes
-
findOneWayAnnotation
protected org.apache.camel.Pattern findOneWayAnnotation(List<Class<?>> classes)
Finds the first annotation on the given list of classes
-
hasExceptionParameter
protected boolean hasExceptionParameter()
-
-