de.intarsys.tools.expression
Class ProcessingDecorator
java.lang.Object
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
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
ProcessingDecorator
public ProcessingDecorator(IStringEvaluator evaluator)
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)
Copyright © 2012 intarsys consulting GmbH. All Rights Reserved.