Class BeanExpression

java.lang.Object
org.apache.camel.language.bean.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 Details

    • BeanExpression

      public BeanExpression(Object bean, String method)
    • BeanExpression

      public BeanExpression(String beanName, String method)
    • BeanExpression

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

    • 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)
    • getParameterMappingStrategy

      public ParameterMappingStrategy getParameterMappingStrategy()
    • setParameterMappingStrategy

      public void setParameterMappingStrategy(ParameterMappingStrategy parameterMappingStrategy)
    • getBeanComponent

      public BeanComponent getBeanComponent()
    • setBeanComponent

      public void setBeanComponent(BeanComponent beanComponent)
    • getSimple

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

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

      public Class<?> getResultType()
    • setResultType

      public void setResultType(Class<?> resultType)
    • 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
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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