org.apache.camel.language.bean
Class BeanLanguage

java.lang.Object
  extended by org.apache.camel.language.bean.BeanLanguage
All Implemented Interfaces:
IsSingleton, Language

public class BeanLanguage
extends Object
implements Language, IsSingleton

A bean language which uses a simple text notation to invoke methods on beans to evaluate predicates or expressions

The notation is essentially beanName.methodName which is then invoked using the beanName to lookup in the bean integration to bind the Exchange to the method arguments.

As of Camel 1.5 the bean language also supports invoking a provided bean by its classname or the bean itself.

Version:

Constructor Summary
BeanLanguage()
           
 
Method Summary
static Expression bean(Class<?> beanType, String method)
          Creates the expression for invoking the bean type.
static Expression bean(Object bean, String method)
          Creates the expression for invoking the bean type.
static Expression bean(String expression)
          Creates the expression based on the string syntax.
 Expression createExpression(Object bean, String method)
           
 Expression createExpression(String expression)
          Creates an expression based on the given string input
 Predicate createPredicate(String expression)
          Creates a predicate based on the given string input
 boolean isSingleton()
          Whether this class supports being singleton or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanLanguage

public BeanLanguage()
Method Detail

bean

public static Expression bean(String expression)
Creates the expression based on the string syntax.

Parameters:
expression - the string syntax beanRef.methodName where methodName can be omitted
Returns:
the expression

bean

public static Expression bean(Class<?> beanType,
                              String method)
Creates the expression for invoking the bean type.

Parameters:
beanType - the bean type to invoke
method - optional name of method to invoke for instance to avoid ambiguity
Returns:
the expression

bean

public static Expression bean(Object bean,
                              String method)
Creates the expression for invoking the bean type.

Parameters:
bean - the bean to invoke
method - optional name of method to invoke for instance to avoid ambiguity
Returns:
the expression

createPredicate

public Predicate createPredicate(String expression)
Description copied from interface: Language
Creates a predicate based on the given string input

Specified by:
createPredicate in interface Language
Parameters:
expression - the expression
Returns:
the created predicate

createExpression

public Expression createExpression(String expression)
Description copied from interface: Language
Creates an expression based on the given string input

Specified by:
createExpression in interface Language
Parameters:
expression - the expression as a string input
Returns:
the created expression

createExpression

public Expression createExpression(Object bean,
                                   String method)

isSingleton

public boolean isSingleton()
Description copied from interface: IsSingleton
Whether this class supports being singleton or not.

Specified by:
isSingleton in interface IsSingleton
Returns:
true to be a single shared instance, false to create new instances.


Apache CAMEL