com.google.sitebricks.compiler
Class MvelEvaluatorCompiler
java.lang.Object
com.google.sitebricks.compiler.MvelEvaluatorCompiler
- All Implemented Interfaces:
- EvaluatorCompiler
@NotThreadSafe
public class MvelEvaluatorCompiler
- extends Object
- implements EvaluatorCompiler
- Author:
- Dhanji R. Prasanna (dhanji@gmail com)
TODO make this thread-safe when pages can be compiled on demand
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MvelEvaluatorCompiler
public MvelEvaluatorCompiler(Class<?> backingType)
MvelEvaluatorCompiler
public MvelEvaluatorCompiler(Map<String,Type> backingTypes)
resolveEgressType
public Type resolveEgressType(String expression)
throws ExpressionCompileException
- Specified by:
resolveEgressType in interface EvaluatorCompiler
- Parameters:
expression - An expression to compile against this compiler (and context class)
- Returns:
- Returns the egress type of the entire expression chain
- Throws:
ExpressionCompileException - If there is a problem
compiling the expression.
isWritable
public boolean isWritable(String property)
throws ExpressionCompileException
- Specified by:
isWritable in interface EvaluatorCompiler
- Parameters:
property - A property of this class to test.
- Returns:
- True if the property has a setter or reasonable alternative that can
be written to by the evaluator produced by this compiler.
- Throws:
ExpressionCompileException
compile
public Evaluator compile(String expression)
throws ExpressionCompileException
- Specified by:
compile in interface EvaluatorCompiler
- Parameters:
expression - An expression to compile against this compiler (and context class)
- Returns:
- Returns An evaluator that can execute the expression against the context class and a
real instance of data.
- Throws:
ExpressionCompileException - If there is a problem compiling the expression.
tokenizeAndCompile
public List<Token> tokenizeAndCompile(String template)
throws ExpressionCompileException
- Specified by:
tokenizeAndCompile in interface EvaluatorCompiler
- Parameters:
template - A String template with embedded EL expressions to convert into a list of
evaluable tokens. These tokens evaluate against given data or simply render plain text as
appropriate. Performs a compile of each expression against the context class of this
EvaluatorCompiler.
- Returns:
- Returns the egress type of the entire expression chain
- Throws:
ExpressionCompileException - If there is a problem
compiling the expression.
Copyright © 2014. All rights reserved.