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 void
afterPropertiesConfigured(org.apache.camel.CamelContext camelContext)
Object
evaluate(org.apache.camel.Exchange exchange)
<T> T
evaluate(org.apache.camel.Exchange exchange, Class<T> type)
Object
getBean()
String
getBeanName()
String
getMethod()
Class<?>
getType()
void
init(org.apache.camel.CamelContext context)
boolean
matches(org.apache.camel.Exchange exchange)
void
setBean(Object bean)
void
setBeanName(String beanName)
void
setMethod(String method)
void
setType(Class<?> type)
String
toString()
protected void
validateHasMethod(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:
init
in interfaceorg.apache.camel.Expression
- Specified by:
init
in 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:
evaluate
in interfaceorg.apache.camel.Expression
-
matches
public boolean matches(org.apache.camel.Exchange exchange)
- Specified by:
matches
in interfaceorg.apache.camel.Predicate
-
afterPropertiesConfigured
public void afterPropertiesConfigured(org.apache.camel.CamelContext camelContext)
- Specified by:
afterPropertiesConfigured
in 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
-
-