net.sf.jasperreports.compilers

## Class JavaScriptEvaluator

- java.lang.Object
- - net.sf.jasperreports.engine.fill.JREvaluator
  - - net.sf.jasperreports.compilers.JavaScriptEvaluator

- All Implemented Interfaces:
    DatasetExpressionEvaluator, JasperReportsContextAware

      public class JavaScriptEvaluator
      extends JREvaluator
      implements JasperReportsContextAware

  JavaScript expression evaluator that compiles expressions at fill time.
  Version:
    $Id: JavaScriptEvaluator.java 6919 2014-02-21 16:14:20Z lucianc $
  Author:
    Lucian Chirita (lucianc@users.sourceforge.net)
  See Also:
    `JavaScriptCompiler`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `PROPERTY_OPTIMIZATION_LEVEL` Property that determines the optimization level used when compiling expressions.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JavaScriptEvaluator(JasperReportsContext jrContext, JavaScriptCompileData compileData)` Create a JavaScript expression evaluator.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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 JavaScriptCompileData.Expression` | `getExpression(int id)`
    `protected java.lang.Class<?>` | `getTypeClass(java.lang.String type)` Deprecated. To be removed.
    `void` | `setJasperReportsContext(JasperReportsContext context)`

    - ### Methods inherited from class net.sf.jasperreports.engine.fill.JREvaluator

      `evaluate, evaluateEstimated, evaluateOld, getFunctionSupport, 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

    - #### setJasperReportsContext

          public void setJasperReportsContext(JasperReportsContext context)

      Specified by:
        `setJasperReportsContext` in interface `JasperReportsContextAware`

    - #### 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)

    - #### getTypeClass

          protected java.lang.Class<?> getTypeClass(java.lang.String type)

      Deprecated. To be removed.

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com