Class JRClassGenerator


  • public class JRClassGenerator
    extends java.lang.Object
    Author:
    Teodor Danciu (teodord@users.sourceforge.net)
    • Field Detail

      • PROPERTY_MAX_METHOD_SIZE

        public static final java.lang.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 java.lang.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 java.lang.String SOURCE_EXPRESSION_ID_END
        See Also:
        Constant Field Values
      • parametersMap

        protected java.util.Map<java.lang.String,​? extends JRParameter> parametersMap
      • fieldsMap

        protected java.util.Map<java.lang.String,​JRField> fieldsMap
      • variablesMap

        protected java.util.Map<java.lang.String,​JRVariable> variablesMap
    • 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
      • generateClassStart

        protected final void generateClassStart​(java.lang.StringBuilder sb)
      • generateDeclarations

        protected final void generateDeclarations​(java.lang.StringBuilder sb)
      • generateInitParamsMethod

        protected final void generateInitParamsMethod​(java.lang.StringBuilder sb)
                                               throws JRException
        Throws:
        JRException
      • generateInitFieldsMethod

        protected final void generateInitFieldsMethod​(java.lang.StringBuilder sb)
                                               throws JRException
        Throws:
        JRException
      • generateInitVarsMethod

        protected final void generateInitVarsMethod​(java.lang.StringBuilder sb)
                                             throws JRException
        Throws:
        JRException
      • generateMethod

        protected final java.lang.String generateMethod​(byte evaluationType,
                                                        java.util.List<JRExpression> expressionsList)
                                                 throws JRException
        Throws:
        JRException
      • writeMethodStart

        protected void writeMethodStart​(java.lang.StringBuilder sb,
                                        byte evaluationType,
                                        int methodIndex)
      • writeExpression

        protected void writeExpression​(java.lang.StringBuilder sb,
                                       JRExpression expression,
                                       byte evaluationType)
      • writeMethodEnd

        protected void writeMethodEnd​(java.lang.StringBuilder sb,
                                      byte evaluationType,
                                      java.lang.Integer nextMethodIndex)
      • appendExpressionText

        protected void appendExpressionText​(JRExpression expression,
                                            java.lang.StringBuilder sb,
                                            java.lang.String chunkText)
      • appendExpressionComment

        protected void appendExpressionComment​(java.lang.StringBuilder sb,
                                               JRExpression expression)
      • getLineExpression

        protected JRExpression getLineExpression​(java.lang.String line)
      • modifySource

        protected JRCompilationSourceCode modifySource​(java.util.Set<java.lang.reflect.Method> missingMethods,
                                                       java.lang.String sourceCode)
      • addMethod

        protected void addMethod​(java.lang.StringBuilder methodBuilder,
                                 java.lang.reflect.Method method)