intarsys runtime library

de.intarsys.tools.expression
Class ProcessingDecorator

java.lang.Object
  extended by de.intarsys.tools.expression.ProcessingDecorator
All Implemented Interfaces:
IStringEvaluator

public class ProcessingDecorator
extends Object
implements IStringEvaluator

A decorating IStringEvaluator to add result processing support to an other embedded IStringEvaluator. The command to be performed is separated from the expression to be processed by a ":" character.

You can suffix the original expression by as many commands as you like, for example

 my ${var:*:dts}
 
will recursivly expand "var" and apply a conversion to a short time format afterwards.

Currently we support processing the evaluated result with the following command characters:

?[expression]
return the evaluated result if expression is true, null otherwise. Currently only expressions representing access to boolean arguments are supported
.
reflective access to the value returned by the decorated evaluation
#
perform the named functor (action) on the result
+
re - perform evaluation on the result one time
*
perform evaluation on the result until it is no longer changed (or null)
[char][formatting options]
perform the string formatting selected by the "char"
[empty]
perform the default string formatting


Field Summary
static String ARG_SEPARATOR
           
static char CLOSE_BRACE
           
static char CODE_CONDITIONAL
           
static char CODE_DEEPRECURSION
           
static char CODE_FUNCTOR
           
static char CODE_REFLECTION
           
static char CODE_SHALLOWRECURSION
           
static char OPEN_BRACE
           
static char PROCESSING_SEPARATOR
           
 
Constructor Summary
ProcessingDecorator(IStringEvaluator evaluator)
           
 
Method Summary
 Object evaluate(String expression, IArgs args)
          Evaluate an expression according to the syntax used by the implementor and return the result.
 IStringEvaluator getEvaluator()
           
static IFunctorRegistry getFormattingFunctors()
           
 IStringEvaluator getRecursionEvaluator()
           
 char getSeparator()
           
 String getSeparatorString()
           
static void setFormattingFunctors(IFunctorRegistry formattingFunctors)
           
 void setRecursionEvaluator(IStringEvaluator recursionEvaluator)
           
 void setSeparator(char separator)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROCESSING_SEPARATOR

public static final char PROCESSING_SEPARATOR
See Also:
Constant Field Values

ARG_SEPARATOR

public static final String ARG_SEPARATOR
See Also:
Constant Field Values

CLOSE_BRACE

public static final char CLOSE_BRACE
See Also:
Constant Field Values

OPEN_BRACE

public static final char OPEN_BRACE
See Also:
Constant Field Values

CODE_REFLECTION

public static final char CODE_REFLECTION
See Also:
Constant Field Values

CODE_FUNCTOR

public static final char CODE_FUNCTOR
See Also:
Constant Field Values

CODE_DEEPRECURSION

public static final char CODE_DEEPRECURSION
See Also:
Constant Field Values

CODE_SHALLOWRECURSION

public static final char CODE_SHALLOWRECURSION
See Also:
Constant Field Values

CODE_CONDITIONAL

public static final char CODE_CONDITIONAL
See Also:
Constant Field Values
Constructor Detail

ProcessingDecorator

public ProcessingDecorator(IStringEvaluator evaluator)
Method Detail

getFormattingFunctors

public static IFunctorRegistry getFormattingFunctors()

setFormattingFunctors

public static void setFormattingFunctors(IFunctorRegistry formattingFunctors)

evaluate

public Object evaluate(String expression,
                       IArgs args)
                throws EvaluationException
Description copied from interface: IStringEvaluator
Evaluate an expression according to the syntax used by the implementor and return the result.

Specified by:
evaluate in interface IStringEvaluator
Parameters:
expression - The expression to evaluate.
Returns:
The result object.
Throws:
EvaluationException - If we encounter a compile or runtime error.

getEvaluator

public IStringEvaluator getEvaluator()

getRecursionEvaluator

public IStringEvaluator getRecursionEvaluator()

getSeparator

public char getSeparator()

getSeparatorString

public String getSeparatorString()

setRecursionEvaluator

public void setRecursionEvaluator(IStringEvaluator recursionEvaluator)

setSeparator

public void setSeparator(char separator)

intarsys runtime library

Copyright © 2012 intarsys consulting GmbH. All Rights Reserved.