Class MethodInfo


  • public class MethodInfo
    extends Object
    Information about a method to be used for invocation.
    • Constructor Detail

      • MethodInfo

        public 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 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 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 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)
      • 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 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 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()