Package net.sf.jasperreports.compilers
Class JavaScriptCompilerBase
- java.lang.Object
-
- net.sf.jasperreports.engine.design.JRAbstractCompiler
-
- 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.- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classJavaScriptCompilerBase.Errorsprotected static classJavaScriptCompilerBase.ScriptExpressionVisitor
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringEXCEPTION_MESSAGE_KEY_INVALID_COMPILE_DATA_TYPE-
Fields inherited from class net.sf.jasperreports.engine.design.JRAbstractCompiler
EXCEPTION_MESSAGE_KEY_CROSSTAB_ID_NOT_FOUND, EXCEPTION_MESSAGE_KEY_DESIGN_COMPILE_ERROR, EXCEPTION_MESSAGE_KEY_LANGUAGE_NOT_SUPPORTED, EXCEPTION_MESSAGE_KEY_REPORT_EXPRESSIONS_COMPILE_ERROR, EXCEPTION_MESSAGE_KEY_TEMP_DIR_NOT_FOUND, jasperReportsContext, reportClassFilter
-
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 Modifier Constructor Description protectedJavaScriptCompilerBase(JasperReportsContext jasperReportsContext)Creates a JavaScript compiler.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckLanguage(java.lang.String language)Checks that the report language is supported by the compiler.protected JavaScriptCompilerBase.ScriptExpressionVisitordefaultExpressionCreator()protected JavaScriptCompilerBase.ScriptExpressionVisitorestimatedExpressionCreator()protected JRCompilationSourceCodegenerateSourceCode(JRSourceCompileTask sourceTask)Generates expression evaluator code.protected static java.lang.StringgetFieldVar(java.lang.String name)protected static java.lang.StringgetParameterVar(java.lang.String name)protected java.lang.StringgetSourceFileName(java.lang.String unitName)Returns the name of the source file where generated source code for an unit is saved.protected static java.lang.StringgetVariableVar(java.lang.String name)protected JREvaluatorloadEvaluator(java.io.Serializable compileData, java.lang.String unitName)Creates an expression evaluator instance from data saved when the report was compiled.protected JavaScriptCompilerBase.ScriptExpressionVisitoroldExpressionCreator()-
Methods inherited from class net.sf.jasperreports.engine.design.JRAbstractCompiler
compileReport, compileUnits, createCompileData, createEvaluator, directValueFilter, effectiveDirectValueFilter, getCompilerClass, getSourceFile, getUnitName, getUnitName, getUnitName, getUnitName, getUnitName, loadEvaluator, loadEvaluator, loadEvaluator
-
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_INVALID_COMPILE_DATA_TYPE
public static final java.lang.String EXCEPTION_MESSAGE_KEY_INVALID_COMPILE_DATA_TYPE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JavaScriptCompilerBase
protected JavaScriptCompilerBase(JasperReportsContext jasperReportsContext)
Creates a JavaScript compiler.
-
-
Method Detail
-
checkLanguage
protected void checkLanguage(java.lang.String language) throws JRExceptionDescription copied from class:JRAbstractCompilerChecks that the report language is supported by the compiler.- Specified by:
checkLanguagein classJRAbstractCompiler- Parameters:
language- the report language- Throws:
JRException
-
generateSourceCode
protected JRCompilationSourceCode generateSourceCode(JRSourceCompileTask sourceTask) throws JRException
Description copied from class:JRAbstractCompilerGenerates expression evaluator code.- Specified by:
generateSourceCodein classJRAbstractCompiler- 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:JRAbstractCompilerReturns 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_FILEis set, the generated source will be saved in a file having the name returned by this method.- Specified by:
getSourceFileNamein classJRAbstractCompiler- 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:JRAbstractCompilerCreates an expression evaluator instance from data saved when the report was compiled.- Specified by:
loadEvaluatorin classJRAbstractCompiler- Parameters:
compileData- the data saved when the report was compiledunitName- 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)
-
-