org.apache.camel.language.simple
Class SimpleLanguage

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

public class SimpleLanguage
extends LanguageSupport

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
           
 
Fields inherited from class org.apache.camel.support.LanguageSupport
RESOURCE
 
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
 Expression createExpression(String expression, Class<?> resultType)
           
 Predicate createPredicate(String expression)
          Creates a predicate based on the given string input
static Expression expression(String expression)
          Creates a new Expression.
static Predicate predicate(String predicate)
          Creates a new Predicate.
 void setFunctionEndToken(String endToken)
          Change the end token used for functions.
 void setFunctionStartToken(String startToken)
          Change the start token used for functions.
static Expression simple(String expression)
          Creates a new Expression.
static Expression simple(String expression, Class<?> resultType)
          Creates a new Expression (or Predicate if the resultType is a Boolean, or boolean type).
 
Methods inherited from class org.apache.camel.support.LanguageSupport
getCamelContext, isSingleton, loadResource, setCamelContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

allowEscape

protected boolean allowEscape
Constructor Detail

SimpleLanguage

public SimpleLanguage()
Default constructor.

Method Detail

createPredicate

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

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

Parameters:
expression - the expression as a string input
Returns:
the created expression

simple

public static Expression simple(String expression)
Creates a new Expression.

Important: If you need to use a predicate (function to return true|false) then use predicate(String) instead.


simple

public static Expression simple(String expression,
                                Class<?> resultType)
Creates a new Expression (or Predicate if the resultType is a Boolean, or boolean type).


createExpression

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

expression

public static Expression expression(String expression)
Creates a new Expression.

Important: If you need to use a predicate (function to return true|false) then use predicate(String) instead.


predicate

public static Predicate predicate(String predicate)
Creates a new Predicate.


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