org.apache.camel.language.simple
Class SimpleLanguage

java.lang.Object
  extended by org.apache.camel.language.simple.SimpleLanguageSupport
      extended by org.apache.camel.language.simple.SimpleLanguage
All Implemented Interfaces:
IsSingleton, Language

public class SimpleLanguage
extends SimpleLanguageSupport

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.

Version:

Field Summary
 
Fields inherited from class org.apache.camel.language.simple.SimpleLanguageSupport
ANDOR_PATTERN, log, OPERATOR_PATTERN, OPERATOR_REGEX, RANGE_PATTERN, START_ANDOR_PATTERN
 
Constructor Summary
SimpleLanguage()
           
 
Method Summary
 Expression createExpression(String expression)
          Creates an expression based on the given string input
protected  Expression createSimpleExpression(String expression, boolean strict)
          Creates the simple expression based on the extracted content from the ${ } place holders
protected  Expression createSimpleExpressionDirectly(String expression)
           
protected  Expression createSimpleFileExpression(String remainder)
           
 Class<?> getResultType()
           
static boolean hasStartToken(String expression)
          Does the expression have the simple language start token?
 boolean isSingleton()
          Whether this class supports being singleton or not.
 void setResultType(Class<?> resultType)
           
static Expression simple(String expression)
           
static Expression simple(String expression, Class<?> resultType)
           
 
Methods inherited from class org.apache.camel.language.simple.SimpleLanguageSupport
createComplexConcatExpression, createConstantExpression, createConstantExpression, createPredicate, createSimpleOrConstantExpression, ifStartsWithReturnRemainder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleLanguage

public SimpleLanguage()
Method Detail

getResultType

public Class<?> getResultType()

setResultType

public void setResultType(Class<?> resultType)

isSingleton

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

Returns:
true to be a single shared instance, false to create new instances.

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
Overrides:
createExpression in class SimpleLanguageSupport
Parameters:
expression - the expression as a string input
Returns:
the created expression

hasStartToken

public static boolean hasStartToken(String expression)
Does the expression have the simple language start token?

Parameters:
expression - the expression
Returns:
true if the expression contains the start token, false otherwise

simple

public static Expression simple(String expression)

simple

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

createSimpleExpressionDirectly

protected Expression createSimpleExpressionDirectly(String expression)

createSimpleExpression

protected Expression createSimpleExpression(String expression,
                                            boolean strict)
Description copied from class: SimpleLanguageSupport
Creates the simple expression based on the extracted content from the ${ } place holders

Specified by:
createSimpleExpression in class SimpleLanguageSupport
Parameters:
expression - the content between ${ and }
strict - whether it is strict mode or not, if strict it will throw a ExpressionIllegalSyntaxException if the expression was not known. Set to false to support constant expressions
Returns:
the expression

createSimpleFileExpression

protected Expression createSimpleFileExpression(String remainder)


Apache CAMEL