Class JRClassGenerator
- java.lang.Object
-
- net.sf.jasperreports.engine.design.JRClassGenerator
-
public class JRClassGenerator extends Object
- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,JRField>
fieldsMap
protected Map<String,? extends JRParameter>
parametersMap
static String
PROPERTY_MAX_METHOD_SIZE
Property that determines the maximum size of a generated Java methodprotected static String
SOURCE_EXPRESSION_ID_END
protected static String
SOURCE_EXPRESSION_ID_START
protected static int
SOURCE_EXPRESSION_ID_START_LENGTH
protected JRSourceCompileTask
sourceTask
protected JRVariable[]
variables
protected Map<String,JRVariable>
variablesMap
-
Constructor Summary
Constructors Modifier Constructor Description protected
JRClassGenerator(JRSourceCompileTask sourceTask)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addMethod(StringBuilder methodBuilder, Method method)
protected void
appendExpressionComment(StringBuilder sb, JRExpression expression)
protected void
appendExpressionText(JRExpression expression, StringBuilder sb, String chunkText)
protected JRCompilationSourceCode
generateClass()
static JRCompilationSourceCode
generateClass(JRSourceCompileTask sourceTask)
Generates Java source code for evaluating the expressions of a report/dataset/crosstab.protected void
generateClassStart(StringBuilder sb)
protected void
generateDeclarations(StringBuilder sb)
protected void
generateInitFieldsMethod(StringBuilder sb)
protected void
generateInitParamsMethod(StringBuilder sb)
protected void
generateInitVarsMethod(StringBuilder sb)
protected String
generateMethod(byte evaluationType, List<JRExpression> expressionsList)
protected JRExpression
getLineExpression(String line)
protected JRCompilationSourceCode
modifySource(Set<Method> missingMethods, String sourceCode)
static JRCompilationSourceCode
modifySource(JRSourceCompileTask sourceTask, Set<Method> missingMethods, String sourceCode)
protected JRDefaultCompilationSourceCode
parseSourceLines(String sourceCode)
protected void
writeExpression(StringBuilder sb, JRExpression expression, byte evaluationType)
protected void
writeMethodEnd(StringBuilder sb, byte evaluationType, Integer nextMethodIndex)
protected void
writeMethodStart(StringBuilder sb, byte evaluationType, int methodIndex)
-
-
-
Field Detail
-
PROPERTY_MAX_METHOD_SIZE
public static final String PROPERTY_MAX_METHOD_SIZE
Property that determines the maximum size of a generated Java method- See Also:
- Constant Field Values
-
SOURCE_EXPRESSION_ID_START
protected static final String SOURCE_EXPRESSION_ID_START
- See Also:
- Constant Field Values
-
SOURCE_EXPRESSION_ID_START_LENGTH
protected static final int SOURCE_EXPRESSION_ID_START_LENGTH
-
SOURCE_EXPRESSION_ID_END
protected static final String SOURCE_EXPRESSION_ID_END
- See Also:
- Constant Field Values
-
sourceTask
protected final JRSourceCompileTask sourceTask
-
parametersMap
protected Map<String,? extends JRParameter> parametersMap
-
variablesMap
protected Map<String,JRVariable> variablesMap
-
variables
protected JRVariable[] variables
-
-
Constructor Detail
-
JRClassGenerator
protected JRClassGenerator(JRSourceCompileTask sourceTask)
-
-
Method Detail
-
generateClass
public static JRCompilationSourceCode generateClass(JRSourceCompileTask sourceTask) throws JRException
Generates Java source code for evaluating the expressions of a report/dataset/crosstab.- Parameters:
sourceTask
- the source task containing data required to generate the source file- Returns:
- the source code
- Throws:
JRException
-
modifySource
public static JRCompilationSourceCode modifySource(JRSourceCompileTask sourceTask, Set<Method> missingMethods, String sourceCode)
-
generateClass
protected JRCompilationSourceCode generateClass() throws JRException
- Throws:
JRException
-
generateClassStart
protected final void generateClassStart(StringBuilder sb)
-
generateDeclarations
protected final void generateDeclarations(StringBuilder sb)
-
generateInitParamsMethod
protected final void generateInitParamsMethod(StringBuilder sb) throws JRException
- Throws:
JRException
-
generateInitFieldsMethod
protected final void generateInitFieldsMethod(StringBuilder sb) throws JRException
- Throws:
JRException
-
generateInitVarsMethod
protected final void generateInitVarsMethod(StringBuilder sb) throws JRException
- Throws:
JRException
-
generateMethod
protected final String generateMethod(byte evaluationType, List<JRExpression> expressionsList) throws JRException
- Throws:
JRException
-
writeMethodStart
protected void writeMethodStart(StringBuilder sb, byte evaluationType, int methodIndex)
-
writeExpression
protected void writeExpression(StringBuilder sb, JRExpression expression, byte evaluationType)
-
writeMethodEnd
protected void writeMethodEnd(StringBuilder sb, byte evaluationType, Integer nextMethodIndex)
-
appendExpressionText
protected void appendExpressionText(JRExpression expression, StringBuilder sb, String chunkText)
-
appendExpressionComment
protected void appendExpressionComment(StringBuilder sb, JRExpression expression)
-
parseSourceLines
protected JRDefaultCompilationSourceCode parseSourceLines(String sourceCode)
-
getLineExpression
protected JRExpression getLineExpression(String line)
-
modifySource
protected JRCompilationSourceCode modifySource(Set<Method> missingMethods, String sourceCode)
-
addMethod
protected void addMethod(StringBuilder methodBuilder, Method method)
-
-