Package org.apache.camel.language.bean
Class BeanExpression
- java.lang.Object
-
- org.apache.camel.language.bean.BeanExpression
-
- All Implemented Interfaces:
org.apache.camel.AfterPropertiesConfigured,org.apache.camel.Expression,org.apache.camel.Predicate
public class BeanExpression extends Object implements org.apache.camel.Expression, org.apache.camel.Predicate, org.apache.camel.AfterPropertiesConfigured
Evaluates an expression using a bean method invocation
-
-
Constructor Summary
Constructors Constructor Description BeanExpression(Class<?> type, String method)BeanExpression(Object bean, String method)BeanExpression(String beanName, String method)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesConfigured(org.apache.camel.CamelContext camelContext)Objectevaluate(org.apache.camel.Exchange exchange)<T> Tevaluate(org.apache.camel.Exchange exchange, Class<T> type)ObjectgetBean()StringgetBeanName()StringgetMethod()Class<?>getType()voidinit(org.apache.camel.CamelContext context)booleanmatches(org.apache.camel.Exchange exchange)voidsetBean(Object bean)voidsetBeanName(String beanName)voidsetMethod(String method)voidsetType(Class<?> type)StringtoString()protected voidvalidateHasMethod(org.apache.camel.CamelContext context, Object bean, Class<?> type, String method)Validates the given bean has the method.
-
-
-
Method Detail
-
getBean
public Object getBean()
-
setBean
public void setBean(Object bean)
-
getBeanName
public String getBeanName()
-
setBeanName
public void setBeanName(String beanName)
-
getType
public Class<?> getType()
-
setType
public void setType(Class<?> type)
-
getMethod
public String getMethod()
-
setMethod
public void setMethod(String method)
-
init
public void init(org.apache.camel.CamelContext context)
- Specified by:
initin interfaceorg.apache.camel.Expression- Specified by:
initin interfaceorg.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:
evaluatein interfaceorg.apache.camel.Expression
-
matches
public boolean matches(org.apache.camel.Exchange exchange)
- Specified by:
matchesin interfaceorg.apache.camel.Predicate
-
afterPropertiesConfigured
public void afterPropertiesConfigured(org.apache.camel.CamelContext camelContext)
- Specified by:
afterPropertiesConfiguredin interfaceorg.apache.camel.AfterPropertiesConfigured
-
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 contextbean- the bean instancetype- the bean typemethod- the method, can be null if no method name provided- Throws:
org.apache.camel.RuntimeCamelException- is thrown if bean does not have the method
-
-