net.sf.jasperreports.compilers

## Class JRGroovyCompiler

- java.lang.Object
- - net.sf.jasperreports.engine.design.JRAbstractCompiler
  - - net.sf.jasperreports.engine.design.JRAbstractJavaCompiler
    - - net.sf.jasperreports.compilers.JRGroovyCompiler

- All Implemented Interfaces:
    JRCompiler

      public class JRGroovyCompiler
      extends JRAbstractJavaCompiler

  Calculator compiler that uses groovy to compile expressions.
  Version:
    $Id: JRGroovyCompiler.java 5877 2013-01-07 19:51:14Z teodord $
  Author:
    Teodor Danciu (teodord@users.sourceforge.net), Peter Severin (peter_p_s@users.sourceforge.net)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static java.lang.String` | `SOURCE_ENCODING`

    - ### Fields inherited from class net.sf.jasperreports.engine.design.JRAbstractJavaCompiler

      `PROPERTY_EVALUATOR_CLASS_REFERENCE_FIX_ENABLED`

    - ### Fields inherited from class net.sf.jasperreports.engine.design.JRAbstractCompiler

      `jasperReportsContext`

    - ### Fields inherited from interface net.sf.jasperreports.engine.design.JRCompiler

      `COMPILER_CLASS, COMPILER_CLASSPATH, COMPILER_KEEP_JAVA_FILE, COMPILER_PREFIX, COMPILER_TEMP_DIR`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JRGroovyCompiler()` Deprecated. Replaced by `JRGroovyCompiler(JasperReportsContext)`.
    `JRGroovyCompiler(JasperReportsContext jasperReportsContext)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `checkLanguage(java.lang.String language)` Checks that the report language is supported by the compiler.
    `protected java.lang.String` | `compileUnits(JRCompilationUnit[] units, java.lang.String classpath, java.io.File tempDirFile)` Compiles several expression evaluator units.
    `protected JRCompilationSourceCode` | `generateSourceCode(JRSourceCompileTask sourceTask)` Generates expression evaluator code.
    `protected java.lang.String` | `getSourceFileName(java.lang.String unitName)` Returns the name of the source file where generated source code for an unit is saved.

    - ### Methods inherited from class net.sf.jasperreports.engine.design.JRAbstractJavaCompiler

      `classCacheKey, getClassFromCache, loadEvaluator, putClassInCache`

    - ### Methods inherited from class net.sf.jasperreports.engine.design.JRAbstractCompiler

      `compileReport, getCompilerClass, getSourceFile, getUnitName, getUnitName, getUnitName, getUnitName, getUnitName, loadEvaluator, loadEvaluator, loadEvaluator`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### SOURCE_ENCODING

          protected static final java.lang.String SOURCE_ENCODING

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### JRGroovyCompiler

          public JRGroovyCompiler(JasperReportsContext jasperReportsContext)

    - #### JRGroovyCompiler

          public JRGroovyCompiler()

      Deprecated. Replaced by `JRGroovyCompiler(JasperReportsContext)`.

  - ### Method Detail

    - #### compileUnits

          protected java.lang.String compileUnits(JRCompilationUnit[] units,
                                      java.lang.String classpath,
                                      java.io.File tempDirFile)
                                           throws JRException

      Description copied from class: `JRAbstractCompiler`
      Compiles several expression evaluator units.

      The result of the compilation should be set by calling `setCompileData` on all compile units.

      Specified by:
        `compileUnits` in class `JRAbstractCompiler`
      Parameters:
        `units` - the compilation units
        `classpath` - the compilation classpath
        `tempDirFile` - temporary directory
      Returns:
        a string containing compilation errors, or null if the compilation was successfull
      Throws:
        `JRException`

    - #### checkLanguage

          protected void checkLanguage(java.lang.String language)
                                throws JRException

      Description copied from class: `JRAbstractCompiler`
      Checks that the report language is supported by the compiler.
      Specified by:
        `checkLanguage` in class `JRAbstractCompiler`
      Parameters:
        `language` - the report language
      Throws:
        `JRException`

    - #### generateSourceCode

          protected JRCompilationSourceCode generateSourceCode(JRSourceCompileTask sourceTask)
                                                        throws JRException

      Description copied from class: `JRAbstractCompiler`
      Generates expression evaluator code.
      Specified by:
        `generateSourceCode` in class `JRAbstractCompiler`
      Parameters:
        `sourceTask` - the source code generation information
      Returns:
        generated expression evaluator code
      Throws:
        `JRException`

    - #### getSourceFileName

          protected java.lang.String getSourceFileName(java.lang.String unitName)

      Description copied from class: `JRAbstractCompiler`
      Returns the name of the source file where generated source code for an unit is saved.

      If the compiler needs source files for compilation or `COMPILER_KEEP_JAVA_FILE` is set, the generated source will be saved in a file having the name returned by this method.

      Specified by:
        `getSourceFileName` in class `JRAbstractCompiler`
      Parameters:
        `unitName` - the unit name
      Returns:
        the source file name

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com