Package org.apache.camel.model.language
Class MethodCallExpression
- java.lang.Object
-
- org.apache.camel.model.language.ExpressionDefinition
-
- org.apache.camel.model.language.TypedExpressionDefinition
-
- org.apache.camel.model.language.MethodCallExpression
-
- All Implemented Interfaces:
org.apache.camel.Expression
,org.apache.camel.ExpressionFactory
,HasExpressionType
,org.apache.camel.Predicate
,org.apache.camel.PredicateFactory
,org.apache.camel.spi.ExpressionFactoryAware
,org.apache.camel.spi.PredicateFactoryAware
@Metadata(firstVersion="1.3.0", label="language,core,java", title="Bean Method") public class MethodCallExpression extends TypedExpressionDefinition
Calls a Java bean method.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MethodCallExpression.Builder
Builder
is a specific builder forMethodCallExpression
.-
Nested classes/interfaces inherited from class org.apache.camel.model.language.TypedExpressionDefinition
TypedExpressionDefinition.AbstractBuilder<T extends TypedExpressionDefinition.AbstractBuilder<T,E>,E extends TypedExpressionDefinition>
-
-
Constructor Summary
Constructors Constructor Description MethodCallExpression()
MethodCallExpression(Class<?> type)
MethodCallExpression(Class<?> type, String method)
MethodCallExpression(Object instance)
MethodCallExpression(Object instance, String method)
MethodCallExpression(String beanName)
MethodCallExpression(String beanName, String method)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<?>
getBeanType()
String
getBeanTypeName()
Object
getInstance()
String
getLanguage()
String
getMethod()
String
getRef()
String
getScope()
void
setBeanType(Class<?> beanType)
void
setBeanTypeName(String beanTypeName)
Class name (fully qualified) of the bean to use Will lookup in registry and if there is a single instance of the same type, then the existing bean is used, otherwise a new bean is created (requires a default no-arg constructor).void
setInstance(Object instance)
void
setMethod(String method)
Name of method to callvoid
setRef(String ref)
Reference to an existing bean (bean id) to lookup in the registryvoid
setScope(String scope)
Scope of bean.String
toString()
-
Methods inherited from class org.apache.camel.model.language.TypedExpressionDefinition
getResultType, getResultTypeName, setResultType, setResultTypeName
-
Methods inherited from class org.apache.camel.model.language.ExpressionDefinition
createExpression, createPredicate, evaluate, getExpression, getExpressionFactory, getExpressionType, getExpressionValue, getId, getLabel, getLabel, getPredicate, getPredicateFactory, getTrim, init, initPredicate, matches, setExpression, setExpressionType, setExpressionValue, setId, setTrim
-
-
-
-
Method Detail
-
getLanguage
public String getLanguage()
- Overrides:
getLanguage
in classExpressionDefinition
-
getRef
public String getRef()
-
setRef
public void setRef(String ref)
Reference to an existing bean (bean id) to lookup in the registry
-
getMethod
public String getMethod()
-
setMethod
public void setMethod(String method)
Name of method to call
-
getBeanType
public Class<?> getBeanType()
-
setBeanType
public void setBeanType(Class<?> beanType)
-
getBeanTypeName
public String getBeanTypeName()
-
setBeanTypeName
public void setBeanTypeName(String beanTypeName)
Class name (fully qualified) of the bean to use Will lookup in registry and if there is a single instance of the same type, then the existing bean is used, otherwise a new bean is created (requires a default no-arg constructor).
-
getScope
public String getScope()
-
setScope
public void setScope(String scope)
Scope of bean. When using singleton scope (default) the bean is created or looked up only once and reused for the lifetime of the endpoint. The bean should be thread-safe in case concurrent threads is calling the bean at the same time. When using request scope the bean is created or looked up once per request (exchange). This can be used if you want to store state on a bean while processing a request and you want to call the same bean instance multiple times while processing the request. The bean does not have to be thread-safe as the instance is only called from the same request. When using prototype scope, then the bean will be looked up or created per call. However in case of lookup then this is delegated to the bean registry such as Spring or CDI (if in use), which depends on their configuration can act as either singleton or prototype scope. So when using prototype scope then this depends on the bean registry implementation.
-
getInstance
public Object getInstance()
-
setInstance
public void setInstance(Object instance)
-
toString
public String toString()
- Overrides:
toString
in classExpressionDefinition
-
-