# Package net.sf.jasperreports.compilers

Contains classes for report compiling and expressions evaluating.

See: Description

- Class Summary
  Class | Description
  --- | ---
  GroovyEvaluator | Groovy expression evaluator that compiles expressions at fill time.
  JavaScriptCallableThisDecorator |
  JavaScriptClassCompiler | Compiler for reports that use JavaScript as expression language.
  JavaScriptClassCompiler.CompileSources |
  JavaScriptClassLoader | Class loader used to load classes generated for JavaScript expression evaluation.
  JavaScriptCompileData | Compile data for reports that use JavaScript as expression language.
  JavaScriptCompileData.Expression |
  JavaScriptCompiledData | Compiled Java code for reports that use JavaScript as expression language.
  JavaScriptCompiledData.CompiledClass |
  JavaScriptCompiledData.ExpressionIndexes |
  JavaScriptCompiledEvaluator | JavaScript expression evaluator that uses Java bytecode compiled by `JavaScriptClassCompiler`.
  JavaScriptCompiler | Compiler for reports that use JavaScript as expression language.
  JavaScriptCompilerBase | Base compiler class for reports that use JavaScript as expression language.
  JavaScriptCompilerBase.Errors |
  JavaScriptCompilerBase.ScriptExpressionVisitor |
  JavaScriptEvaluator | JavaScript expression evaluator that compiles expressions at fill time.
  JavaScriptEvaluatorScope |
  JavaScriptEvaluatorScope.JSField | Field class used in JavaScript expressions.
  JavaScriptEvaluatorScope.JSParameter | Parameter class used in JavaScript expressions.
  JavaScriptEvaluatorScope.JSValue | Base JavaScript value class.
  JavaScriptEvaluatorScope.JSVariable | Variable class used in JavaScript expressions.
  JavaScriptFunctionsObject |
  JRBshCompiler |
  JRBshEvaluator | BeanShell expression evaluator that compiles expressions at fill time.
  JRBshGenerator |
  JRGroovyCompiler | Calculator compiler that uses groovy to compile expressions.
  JRGroovyGenerator |

## Package net.sf.jasperreports.compilers Description

Contains classes for report compiling and expressions evaluating.

### Compiling Report Templates

Source report templates, created either by using the API or by parsing JRXML files, are subject to the report compilation process before they are filled with data.

This is necessary to make various consistency validations and to incorporate into these report templates data used to evaluate all report expressions at runtime.

The compilation process transforms `JasperDesign` objects into `JasperReport` objects. Both classes are implementations of the same basic `JRReport` interface. However, `JasperReport` objects cannot be modified once they are produced, while `JasperDesign` objects can. This is because some modifications made on the report template would probably require re-validation, or if a report expression is modified, the compiler-associated data stored inside the report template would have to be updated.

`JasperDesign` objects are produced when parsing JRXML files using the `JRXmlLoader` or created directly by the parent application if dynamic report templates are required. The GUI tools for editing JasperReports templates also work with this class to make in-memory modifications to the report templates before storing them on disk.

A `JasperDesign` object must be subject to the report compilation process to produce a JasperReport object.

Central to this process is the `JRCompiler` interface, which defines two methods, one being the following:

     public JasperReport compileReport(JasperDesign design) throws JRException;

There are several implementations for this compiler interface depending on the language used for the report expressions or the mechanism used for their runtime evaluation.

### Expressions Scripting Language

The default language for the report expressions is Java, but report expressions can be written in Groovy, JavaScript or any other scripting language as long as a report compiler implementation that can evaluate them at runtime is available.

JasperReports currently ships report compiler implementations for the Groovy scripting language (http://groovy.codehaus.org), JavaScript (http://www.mozilla.org/rhino), and the BeanShell scripting library (http://www.beanshell.org). The compiler implementation classes are:

- `JRGroovyCompiler`
- `JavaScriptCompiler`
- `JRBshCompiler`

Historically, these compiler implementations used to be shipped as separate samples, but now they are part of the core library.

### Related Documentation

JasperReports Tutorial

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com