net.sf.jasperreports.compilers
Class JavaScriptCompilerBase

java.lang.Object
  extended by net.sf.jasperreports.engine.design.JRAbstractCompiler
      extended by net.sf.jasperreports.compilers.JavaScriptCompilerBase
All Implemented Interfaces:
JRCompiler
Direct Known Subclasses:
JavaScriptClassCompiler, JavaScriptCompiler

public abstract class JavaScriptCompilerBase
extends JRAbstractCompiler

Base compiler class for reports that use JavaScript as expression language.

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

Nested Class Summary
protected static class JavaScriptCompilerBase.Errors
           
protected static class JavaScriptCompilerBase.ScriptExpressionVisitor
           
 
Field Summary
 
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
protected JavaScriptCompilerBase()
          Deprecated. Replaced by #JavaScriptCompiler(JasperReportsContext).
protected JavaScriptCompilerBase(JasperReportsContext jasperReportsContext)
          Creates a JavaScript compiler.
 
Method Summary
protected  void checkLanguage(java.lang.String language)
          Checks that the report language is supported by the compiler.
protected  JavaScriptCompilerBase.ScriptExpressionVisitor defaultExpressionCreator()
           
protected  JavaScriptCompilerBase.ScriptExpressionVisitor estimatedExpressionCreator()
           
protected  JRCompilationSourceCode generateSourceCode(JRSourceCompileTask sourceTask)
          Generates expression evaluator code.
protected static java.lang.String getFieldVar(java.lang.String name)
           
protected static java.lang.String getParameterVar(java.lang.String name)
           
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.
protected static java.lang.String getVariableVar(java.lang.String name)
           
protected  JREvaluator loadEvaluator(java.io.Serializable compileData, java.lang.String unitName)
          Creates an expression evaluator instance from data saved when the report was compiled.
protected  JavaScriptCompilerBase.ScriptExpressionVisitor oldExpressionCreator()
           
 
Methods inherited from class net.sf.jasperreports.engine.design.JRAbstractCompiler
compileReport, compileUnits, getCompilerClass, 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
 

Constructor Detail

JavaScriptCompilerBase

protected JavaScriptCompilerBase(JasperReportsContext jasperReportsContext)
Creates a JavaScript compiler.


JavaScriptCompilerBase

protected JavaScriptCompilerBase()
Deprecated. Replaced by #JavaScriptCompiler(JasperReportsContext).

Method Detail

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

loadEvaluator

protected JREvaluator loadEvaluator(java.io.Serializable compileData,
                                    java.lang.String unitName)
                             throws JRException
Description copied from class: JRAbstractCompiler
Creates an expression evaluator instance from data saved when the report was compiled.

Specified by:
loadEvaluator in class JRAbstractCompiler
Parameters:
compileData - the data saved when the report was compiled
unitName - the evaluator unit name
Returns:
an expression evaluator instance
Throws:
JRException

defaultExpressionCreator

protected JavaScriptCompilerBase.ScriptExpressionVisitor defaultExpressionCreator()

oldExpressionCreator

protected JavaScriptCompilerBase.ScriptExpressionVisitor oldExpressionCreator()

estimatedExpressionCreator

protected JavaScriptCompilerBase.ScriptExpressionVisitor estimatedExpressionCreator()

getParameterVar

protected static java.lang.String getParameterVar(java.lang.String name)

getVariableVar

protected static java.lang.String getVariableVar(java.lang.String name)

getFieldVar

protected static java.lang.String getFieldVar(java.lang.String name)


© 2001-2010 Jaspersoft Corporation www.jaspersoft.com