Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.jasperreports.engine.design
Class JRAbstractCompiler

    java.lang.Object
      net.sf.jasperreports.engine.design.JRAbstractCompiler

All Implemented Interfaces:
  JRCompiler

Direct Known Subclasses:
  JavaScriptCompiler, JRAbstractJavaCompiler, JRBshCompiler

    public abstract class JRAbstractCompiler

extends java.lang.Object
implements JRCompiler

Base class for report compilers.

Version:
  $Id: JRAbstractCompiler.java 3732 2010-04-12 13:08:04Z lucianc $
Author:
  Lucian Chirita (lucianc@users.sourceforge.net)

Field Summary

Fields inherited from interface net.sf.jasperreports.engine.design.JRCompiler
`COMPILER_PREFIX`

Constructor Summary
`protected` | `JRAbstractCompiler(boolean needsSourceFiles)` Constructor.

Method Summary
`protected abstract void` | `checkLanguage(java.lang.String language)` Checks that the report language is supported by the compiler.
`JasperReport` | `compileReport(JasperDesign jasperDesign)` Compiles a report design.
`protected abstract java.lang.String` | `compileUnits(JRCompilationUnit[] units, java.lang.String classpath, java.io.File tempDirFile)` Compiles several expression evaluator units.
`protected abstract JRCompilationSourceCode` | `generateSourceCode(JRSourceCompileTask sourceTask)` Generates expression evaluator code.
`protected java.lang.String` | `getCompilerClass()`
`protected abstract java.lang.String` | `getSourceFileName(java.lang.String unitName)` Returns the name of the source file where generated source code for an unit is saved.
`static java.lang.String` | `getUnitName(JasperReport report, JRCrosstab crosstab)` Returns the name of the expression evaluator unit for a crosstab of a report.
`static java.lang.String` | `getUnitName(JasperReport report, JRDataset dataset)` Returns the name of the expression evaluator unit for a dataset of a report.
`protected static java.lang.String` | `getUnitName(JRReport report, int crosstabId, java.lang.String nameSuffix)`
`protected static java.lang.String` | `getUnitName(JRReport report, JRCrosstab crosstab, JRExpressionCollector expressionCollector, java.lang.String nameSuffix)`
`protected static java.lang.String` | `getUnitName(JRReport report, JRDataset dataset, java.lang.String nameSuffix)`
`JREvaluator` | `loadEvaluator(JasperReport jasperReport)` Loads the evaluator for a report's main dataset.
`JREvaluator` | `loadEvaluator(JasperReport jasperReport, JRCrosstab crosstab)` Loads a expression evaluator class for a crosstab of a report.
`JREvaluator` | `loadEvaluator(JasperReport jasperReport, JRDataset dataset)` Loads a expression evaluator class for a dataset of a report.
`protected abstract JREvaluator` | `loadEvaluator(java.io.Serializable compileData, java.lang.String unitName)` Creates an expression evaluator instance from data saved when the report was compiled.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JRAbstractCompiler

    protected JRAbstractCompiler(boolean needsSourceFiles)

  Constructor.

  Parameters:
    `needsSourceFiles` - whether the compiler needs source files or is able to do in memory compilation

    If true, the generated code is saved in source files to be used by the compiler.

Method Detail

### getUnitName

    public static java.lang.String getUnitName(JasperReport report,
                                               JRDataset dataset)

  Returns the name of the expression evaluator unit for a dataset of a report.

  Parameters:
    `report` - the report
    `dataset` - the dataset
  Returns:
    the generated expression evaluator unit name

### getUnitName

    protected static java.lang.String getUnitName(JRReport report,
                                                  JRDataset dataset,
                                                  java.lang.String nameSuffix)

### getUnitName

    public static java.lang.String getUnitName(JasperReport report,
                                               JRCrosstab crosstab)

  Returns the name of the expression evaluator unit for a crosstab of a report.

  Parameters:
    `report` - the report
    `crosstab` - the crosstab
  Returns:
    the generated expression evaluator unit name

### getUnitName

    protected static java.lang.String getUnitName(JRReport report,
                                                  JRCrosstab crosstab,
                                                  JRExpressionCollector expressionCollector,
                                                  java.lang.String nameSuffix)

### getUnitName

    protected static java.lang.String getUnitName(JRReport report,
                                                  int crosstabId,
                                                  java.lang.String nameSuffix)

### compileReport

    public final JasperReport compileReport(JasperDesign jasperDesign)
                                     throws JRException

  Description copied from interface: `JRCompiler`
  Compiles a report design.

  The compilation consists of verification of the design, generation of expression evaluators and construction of a serializable read-only version of the report.

  A report compiler should usually extend `JRAbstractCompiler`.

  Specified by:
    `compileReport` in interface `JRCompiler`
  Parameters:
    `jasperDesign` - the report design
  Returns:
    the compiled report
  Throws:
    `JRException`

### getCompilerClass

    protected java.lang.String getCompilerClass()

### loadEvaluator

    public JREvaluator loadEvaluator(JasperReport jasperReport)
                              throws JRException

  Description copied from interface: `JRCompiler`
  Loads the evaluator for a report's main dataset.

  Specified by:
    `loadEvaluator` in interface `JRCompiler`
  Parameters:
    `jasperReport` - the report
  Returns:
    the evaluator for the report's main dataset
  Throws:
    `JRException`

### loadEvaluator

    public JREvaluator loadEvaluator(JasperReport jasperReport,
                                     JRDataset dataset)
                              throws JRException

  Description copied from interface: `JRCompiler`
  Loads a expression evaluator class for a dataset of a report.

  Specified by:
    `loadEvaluator` in interface `JRCompiler`
  Parameters:
    `jasperReport` - the report
    `dataset` - the dataset
  Returns:
    an instance of the dataset evaluator class
  Throws:
    `JRException`

### loadEvaluator

    public JREvaluator loadEvaluator(JasperReport jasperReport,
                                     JRCrosstab crosstab)
                              throws JRException

  Description copied from interface: `JRCompiler`
  Loads a expression evaluator class for a crosstab of a report.

  Specified by:
    `loadEvaluator` in interface `JRCompiler`
  Parameters:
    `jasperReport` - the report
    `crosstab` - the crosstab
  Returns:
    an instance of the dataset evaluator class
  Throws:
    `JRException`

### loadEvaluator

    protected abstract JREvaluator loadEvaluator(java.io.Serializable compileData,
                                                 java.lang.String unitName)
                                          throws JRException

  Creates an expression evaluator instance from data saved when the report was compiled.

  Parameters:
    `compileData` - the data saved when the report was compiled
    `unitName` - the evaluator unit name
  Returns:
    an expression evaluator instance
  Throws:
    `JRException`

### checkLanguage

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

  Checks that the report language is supported by the compiler.

  Parameters:
    `language` - the report language
  Throws:
    `JRException`

### generateSourceCode

    protected abstract JRCompilationSourceCode generateSourceCode(JRSourceCompileTask sourceTask)
                                                           throws JRException

  Generates expression evaluator code.

  Parameters:
    `sourceTask` - the source code generation information
  Returns:
    generated expression evaluator code
  Throws:
    `JRException`

### compileUnits

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

  Compiles several expression evaluator units.

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

  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`

### getSourceFileName

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

  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.

  Parameters:
    `unitName` - the unit name
  Returns:
    the source file name

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com