Package net.sf.jasperreports.javascript
Class JavaScriptEvaluator
- java.lang.Object
-
- net.sf.jasperreports.engine.fill.JREvaluator
-
- net.sf.jasperreports.javascript.JavaScriptEvaluator
-
- All Implemented Interfaces:
DatasetExpressionEvaluator
,JasperReportsContextAware
public class JavaScriptEvaluator extends JREvaluator implements JasperReportsContextAware
JavaScript expression evaluator that compiles expressions at fill time.- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
- See Also:
JavaScriptCompiler
-
-
Field Summary
Fields Modifier and Type Field Description static String
EXCEPTION_MESSAGE_KEY_EVALUATOR_LOAD_ERROR
static String
PROPERTY_OPTIMIZATION_LEVEL
Property that determines the optimization level used when compiling expressions.-
Fields inherited from class net.sf.jasperreports.engine.fill.JREvaluator
EXCEPTION_MESSAGE_KEY_RESOURCE_NOT_FOUND, ignoreNPE, PROPERTY_IGNORE_NPE
-
-
Constructor Summary
Constructors Constructor Description JavaScriptEvaluator(JasperReportsContext jrContext, JavaScriptCompileData compileData)
Create a JavaScript expression evaluator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
customizedInit(Map<String,JRFillParameter> parametersMap, Map<String,JRFillField> fieldsMap, Map<String,JRFillVariable> variablesMap)
Initializes the parameters, fields and variables of the evaluator.protected Object
evaluate(int id)
Evaluates an expression using current fields and variables values.protected Object
evaluateEstimated(int id)
Evaluates an expression using estimated variables values.protected Object
evaluateExpression(String expression)
protected Object
evaluateOld(int id)
Evaluates an expression using old fields and variables values.protected JavaScriptCompileData.Expression
getExpression(int id)
void
setJasperReportsContext(JasperReportsContext context)
-
Methods inherited from class net.sf.jasperreports.engine.fill.JREvaluator
evaluate, evaluateEstimated, evaluateOld, getFunctionSupport, handleEvaluationException, handleMissingResource, init, msg, msg, msg, msg, setDirectExpressionEvaluators, str
-
-
-
-
Field Detail
-
PROPERTY_OPTIMIZATION_LEVEL
public static final String PROPERTY_OPTIMIZATION_LEVEL
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_EVALUATOR_LOAD_ERROR
public static final String EXCEPTION_MESSAGE_KEY_EVALUATOR_LOAD_ERROR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JavaScriptEvaluator
public JavaScriptEvaluator(JasperReportsContext jrContext, JavaScriptCompileData compileData)
Create a JavaScript expression evaluator.- Parameters:
compileData
- the report compile data
-
-
Method Detail
-
setJasperReportsContext
public void setJasperReportsContext(JasperReportsContext context)
- Specified by:
setJasperReportsContext
in interfaceJasperReportsContextAware
-
customizedInit
protected void customizedInit(Map<String,JRFillParameter> parametersMap, Map<String,JRFillField> fieldsMap, Map<String,JRFillVariable> variablesMap) throws JRException
Description copied from class:JREvaluator
Initializes the parameters, fields and variables of the evaluator.- Specified by:
customizedInit
in classJREvaluator
- Parameters:
parametersMap
- the parameters indexed by namefieldsMap
- the fields indexed by namevariablesMap
- the variables indexed by name- Throws:
JRException
-
evaluate
protected Object evaluate(int id) throws Throwable
Description copied from class:JREvaluator
Evaluates an expression using current fields and variables values.- Specified by:
evaluate
in classJREvaluator
- Parameters:
id
- the expression id- Returns:
- the result of the evaluation
- Throws:
Throwable
- See Also:
JRExpression.EVALUATION_DEFAULT
,JRFillVariable.getValue()
,JRFillField.getValue()
-
evaluateEstimated
protected Object evaluateEstimated(int id) throws Throwable
Description copied from class:JREvaluator
Evaluates an expression using estimated variables values.- Specified by:
evaluateEstimated
in classJREvaluator
- Parameters:
id
- the expression id- Returns:
- the result of the evaluation
- Throws:
Throwable
- See Also:
JRExpression.EVALUATION_ESTIMATED
,JRFillVariable.getEstimatedValue()
-
evaluateOld
protected Object evaluateOld(int id) throws Throwable
Description copied from class:JREvaluator
Evaluates an expression using old fields and variables values.- Specified by:
evaluateOld
in classJREvaluator
- Parameters:
id
- the expression id- Returns:
- the result of the evaluation
- Throws:
Throwable
- See Also:
JRExpression.EVALUATION_OLD
,JRFillVariable.getOldValue()
,JRFillField.getOldValue()
-
getExpression
protected JavaScriptCompileData.Expression getExpression(int id)
-
-