net.sf.jasperreports.compilers
Class JavaScriptEvaluator

java.lang.Object
  extended by net.sf.jasperreports.engine.fill.JREvaluator
      extended by net.sf.jasperreports.compilers.JavaScriptEvaluator
All Implemented Interfaces:
DatasetExpressionEvaluator

public class JavaScriptEvaluator
extends JREvaluator

JavaScript expression evaluator that compiles expressions at fill time.

Version:
$Id: JavaScriptEvaluator.java 5451 2012-06-14 15:35:10Z lucianc $
Author:
Lucian Chirita (lucianc@users.sourceforge.net)
See Also:
JavaScriptCompiler

Field Summary
static java.lang.String PROPERTY_OPTIMIZATION_LEVEL
          Property that determines the optimization level used when compiling expressions.
 
Constructor Summary
JavaScriptEvaluator(JasperReportsContext jrContext, JavaScriptCompileData compileData)
          Create a JavaScript expression evaluator.
 
Method Summary
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)
          Initializes the parameters, fields and variables of the evaluator.
protected  java.lang.Object evaluate(int id)
          Evaluates an expression using current fields and variables values.
protected  java.lang.Object evaluateEstimated(int id)
          Evaluates an expression using estimated variables values.
protected  java.lang.Object evaluateExpression(java.lang.String expression)
           
protected  java.lang.Object evaluateExpression(java.lang.String type, java.lang.String expression)
          Deprecated. Replaced by evaluateExpression(String).
protected  java.lang.Object evaluateOld(int id)
          Evaluates an expression using old fields and variables values.
protected  org.mozilla.javascript.Script getCompiledExpression(java.lang.String expression)
           
protected  JavaScriptCompileData.Expression getExpression(int id)
           
protected  java.lang.Class<?> getTypeClass(java.lang.String type)
          Deprecated. To be removed.
 
Methods inherited from class net.sf.jasperreports.engine.fill.JREvaluator
evaluate, evaluateEstimated, evaluateOld, handleMissingResource, init, msg, msg, msg, msg, str
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_OPTIMIZATION_LEVEL

public static final java.lang.String PROPERTY_OPTIMIZATION_LEVEL
Property that determines the optimization level used when compiling expressions. See

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

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: JREvaluator
Initializes the parameters, fields and variables of the evaluator.

Specified by:
customizedInit in class JREvaluator
Parameters:
parametersMap - the parameters indexed by name
fieldsMap - the fields indexed by name
variablesMap - the variables indexed by name
Throws:
JRException

evaluate

protected java.lang.Object evaluate(int id)
                             throws java.lang.Throwable
Description copied from class: JREvaluator
Evaluates an expression using current fields and variables values.

Specified by:
evaluate in class JREvaluator
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.Throwable
Description copied from class: JREvaluator
Evaluates an expression using estimated variables values.

Specified by:
evaluateEstimated in class JREvaluator
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.Throwable
Description copied from class: JREvaluator
Evaluates an expression using old fields and variables values.

Specified by:
evaluateOld in class JREvaluator
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 JavaScriptCompileData.Expression getExpression(int id)

evaluateExpression

protected java.lang.Object evaluateExpression(java.lang.String type,
                                              java.lang.String expression)
Deprecated. Replaced by evaluateExpression(String).


evaluateExpression

protected java.lang.Object evaluateExpression(java.lang.String expression)

getCompiledExpression

protected org.mozilla.javascript.Script getCompiledExpression(java.lang.String expression)

getTypeClass

protected java.lang.Class<?> getTypeClass(java.lang.String type)
Deprecated. To be removed.



© 2001-2010 Jaspersoft Corporation www.jaspersoft.com