Package org.apache.camel.language.bean
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 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 Object
evaluate(org.apache.camel.Exchange exchange)
<T> T
evaluate(org.apache.camel.Exchange exchange, Class<T> type)
Object
getBean()
BeanComponent
getBeanComponent()
String
getBeanName()
String
getMethod()
ParameterMappingStrategy
getParameterMappingStrategy()
org.apache.camel.BeanScope
getScope()
org.apache.camel.spi.Language
getSimple()
Class<?>
getType()
void
init(org.apache.camel.CamelContext context)
boolean
matches(org.apache.camel.Exchange exchange)
void
setBeanComponent(BeanComponent beanComponent)
void
setParameterMappingStrategy(ParameterMappingStrategy parameterMappingStrategy)
void
setScope(org.apache.camel.BeanScope scope)
void
setSimple(org.apache.camel.spi.Language simple)
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()
-
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)
-
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
-
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
-
-