org.apache.camel.language.simple
Class SimpleLanguage

java.lang.Object
  extended by org.apache.camel.language.simple.SimpleLanguage
All Implemented Interfaces:
IsSingleton, Language
Direct Known Subclasses:
FileLanguage

public class SimpleLanguage
extends Object
implements Language, IsSingleton

A simple language which maps simple property style notations to access headers and bodies. Examples of supported expressions are:

The simple language supports OGNL notation when accessing either body or header.

The simple language now also includes file language out of the box which means the following expression is also supported:

The relative file is the filename with the starting directory clipped, as opposed to path that will return the full path including the starting directory.
The only file is the filename only with all paths clipped.


Field Summary
protected  boolean allowEscape
           
protected  Class<?> resultType
           
 
Constructor Summary
SimpleLanguage()
          Default constructor.
 
Method Summary
static void changeFunctionEndToken(String... endToken)
          Change the end tokens used for functions.
static void changeFunctionStartToken(String... startToken)
          Change the start tokens used for functions.
 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
 Class<?> getResultType()
           
 boolean isAllowEscape()
           
 boolean isSingleton()
          Whether this class supports being singleton or not.
 void setAllowEscape(boolean allowEscape)
           
 void setFunctionEndToken(String endToken)
          Change the end token used for functions.
 void setFunctionStartToken(String startToken)
          Change the start token used for functions.
 void setResultType(Class<?> resultType)
           
static Expression simple(String expression)
           
static Expression simple(String expression, Class<?> resultType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resultType

protected Class<?> resultType

allowEscape

protected boolean allowEscape
Constructor Detail

SimpleLanguage

public SimpleLanguage()
Default constructor.

Method Detail

getResultType

public Class<?> getResultType()

setResultType

public void setResultType(Class<?> resultType)

isAllowEscape

public boolean isAllowEscape()

setAllowEscape

public void setAllowEscape(boolean allowEscape)

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.

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

simple

public static Expression simple(String expression)

simple

public static Expression simple(String expression,
                                Class<?> resultType)

changeFunctionStartToken

public static void changeFunctionStartToken(String... startToken)
Change the start tokens used for functions.

This can be used to alter the function tokens to avoid clashes with other frameworks etc.

The default start tokens is ${ and $simple{.

Parameters:
startToken - new start token(s) to be used for functions

changeFunctionEndToken

public static void changeFunctionEndToken(String... endToken)
Change the end tokens used for functions.

This can be used to alter the function tokens to avoid clashes with other frameworks etc.

The default end token is }

Parameters:
endToken - new end token(s) to be used for functions

setFunctionStartToken

public void setFunctionStartToken(String startToken)
Change the start token used for functions.

This can be used to alter the function tokens to avoid clashes with other frameworks etc.

The default start tokens is ${ and $simple{.

Parameters:
startToken - new start token to be used for functions

setFunctionEndToken

public void setFunctionEndToken(String endToken)
Change the end token used for functions.

This can be used to alter the function tokens to avoid clashes with other frameworks etc.

The default end token is }

Parameters:
endToken - new end token to be used for functions


Apache CAMEL