Package net.sf.jasperreports.compilers
Class JavaScriptCompiledEvaluator
- java.lang.Object
-
- net.sf.jasperreports.engine.fill.JREvaluator
-
- net.sf.jasperreports.compilers.JavaScriptCompiledEvaluator
-
- All Implemented Interfaces:
DatasetExpressionEvaluator,JasperReportsContextAware
public class JavaScriptCompiledEvaluator extends JREvaluator implements JasperReportsContextAware
JavaScript expression evaluator that uses Java bytecode compiled byJavaScriptClassCompiler.- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringEXPRESSION_ID_VAR-
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 JavaScriptCompiledEvaluator(JasperReportsContext jasperReportsContext, java.lang.String unitName, JavaScriptCompiledData compiledData)Create a JavaScript expression evaluator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcustomizedInit(java.util.Map<java.lang.String,JRFillParameter> parametersMap, java.util.Map<java.lang.String,JRFillField> fieldsMap, java.util.Map<java.lang.String,JRFillVariable> variablesMap)Initializes the parameters, fields and variables of the evaluator.protected java.lang.Objectevaluate(int id)Evaluates an expression using current fields and variables values.protected java.lang.ObjectevaluateEstimated(int id)Evaluates an expression using estimated variables values.protected java.lang.ObjectevaluateExpression(int expressionIndex)protected java.lang.ObjectevaluateOld(int id)Evaluates an expression using old fields and variables values.protected JavaScriptCompiledData.ExpressionIndexesgetExpression(int id)protected static JavaScriptClassLoadergetScriptClassLoader(java.lang.String unitName)voidsetJasperReportsContext(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
-
EXPRESSION_ID_VAR
protected static final java.lang.String EXPRESSION_ID_VAR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JavaScriptCompiledEvaluator
public JavaScriptCompiledEvaluator(JasperReportsContext jasperReportsContext, java.lang.String unitName, JavaScriptCompiledData compiledData)
Create a JavaScript expression evaluator.- Parameters:
jasperReportsContext-unitName-compiledData- the report compile data
-
-
Method Detail
-
getScriptClassLoader
protected static JavaScriptClassLoader getScriptClassLoader(java.lang.String unitName)
-
setJasperReportsContext
public void setJasperReportsContext(JasperReportsContext context)
- Specified by:
setJasperReportsContextin interfaceJasperReportsContextAware
-
customizedInit
protected void customizedInit(java.util.Map<java.lang.String,JRFillParameter> parametersMap, java.util.Map<java.lang.String,JRFillField> fieldsMap, java.util.Map<java.lang.String,JRFillVariable> variablesMap) throws JRException
Description copied from class:JREvaluatorInitializes the parameters, fields and variables of the evaluator.- Specified by:
customizedInitin classJREvaluator- Parameters:
parametersMap- the parameters indexed by namefieldsMap- the fields indexed by namevariablesMap- the variables indexed by name- Throws:
JRException
-
evaluate
protected java.lang.Object evaluate(int id) throws java.lang.ThrowableDescription copied from class:JREvaluatorEvaluates an expression using current fields and variables values.- Specified by:
evaluatein classJREvaluator- Parameters:
id- the expression id- Returns:
- the result of the evaluation
- Throws:
java.lang.Throwable- See Also:
JRExpression.EVALUATION_DEFAULT,JRFillVariable.getValue(),JRFillField.getValue()
-
evaluateEstimated
protected java.lang.Object evaluateEstimated(int id) throws java.lang.ThrowableDescription copied from class:JREvaluatorEvaluates an expression using estimated variables values.- Specified by:
evaluateEstimatedin classJREvaluator- Parameters:
id- the expression id- Returns:
- the result of the evaluation
- Throws:
java.lang.Throwable- See Also:
JRExpression.EVALUATION_ESTIMATED,JRFillVariable.getEstimatedValue()
-
evaluateOld
protected java.lang.Object evaluateOld(int id) throws java.lang.ThrowableDescription copied from class:JREvaluatorEvaluates an expression using old fields and variables values.- Specified by:
evaluateOldin classJREvaluator- Parameters:
id- the expression id- Returns:
- the result of the evaluation
- Throws:
java.lang.Throwable- See Also:
JRExpression.EVALUATION_OLD,JRFillVariable.getOldValue(),JRFillField.getOldValue()
-
getExpression
protected JavaScriptCompiledData.ExpressionIndexes getExpression(int id)
-
evaluateExpression
protected java.lang.Object evaluateExpression(int expressionIndex)
-
-