Class BeanExpression

  • All Implemented Interfaces:
    org.apache.camel.Expression, org.apache.camel.Predicate

    public class BeanExpression
    extends Object
    implements org.apache.camel.Expression, org.apache.camel.Predicate
    Evaluates an expression using a bean method invocation
    • Constructor Detail

      • BeanExpression

        public BeanExpression​(Object bean,
                              String method)
      • BeanExpression

        public BeanExpression​(String beanName,
                              String method)
      • BeanExpression

        public BeanExpression​(Class<?> type,
                              String method)
    • Method Detail

      • getBean

        public Object getBean()
      • getBeanName

        public String getBeanName()
      • getType

        public Class<?> getType()
      • getMethod

        public String getMethod()
      • getScope

        public org.apache.camel.BeanScope getScope()
      • setScope

        public void setScope​(org.apache.camel.BeanScope scope)
      • setParameterMappingStrategy

        public void setParameterMappingStrategy​(ParameterMappingStrategy parameterMappingStrategy)
      • setBeanComponent

        public void setBeanComponent​(BeanComponent beanComponent)
      • getSimple

        public org.apache.camel.spi.Language getSimple()
      • setSimple

        public void setSimple​(org.apache.camel.spi.Language simple)
      • init

        public void init​(org.apache.camel.CamelContext context)
        Specified by:
        init in interface org.apache.camel.Expression
        Specified by:
        init in interface org.apache.camel.Predicate
      • evaluate

        public Object evaluate​(org.apache.camel.Exchange exchange)
      • evaluate

        public <T> T evaluate​(org.apache.camel.Exchange exchange,
                              Class<T> type)
        Specified by:
        evaluate in interface org.apache.camel.Expression
      • matches

        public boolean matches​(org.apache.camel.Exchange exchange)
        Specified by:
        matches in interface org.apache.camel.Predicate
      • validateHasMethod

        protected void validateHasMethod​(org.apache.camel.CamelContext context,
                                         Object bean,
                                         Class<?> type,
                                         String method)
        Validates the given bean has the method.

        This implementation will skip trying to validate OGNL method name expressions.

        Parameters:
        context - camel context
        bean - the bean instance
        type - the bean type
        method - the method, can be null if no method name provided
        Throws:
        org.apache.camel.RuntimeCamelException - is thrown if bean does not have the method