Class JRCalculator

  • All Implemented Interfaces:
    JRFillExpressionEvaluator

    public class JRCalculator
    extends Object
    implements JRFillExpressionEvaluator
    Evaluates JasperReports expressions.

    The expressions calculator is the entity inside JasperReports that evaluates expressions and increments variables or datasets at report-filling time. When a report template is compiled, the report compiler produces and stores in the compiled report template (JasperReport object) information that it will use at report-filling time to build an instance of the JRCalculator class.

    The Java-based report compilers generate a Java source file and compile it on the fly. This generated class is a subclass of the JRCalculator, and the bytecode produced by compiling it is stored inside the JasperReport object. At report-filling time, this bytecode is loaded and the resulting class is instantiated to obtain the calculator object needed for expression evaluation.

    Only the report compiler creates the calculator instance because only the report compiler can make sense of the information it stored in the compiled report template at report compilation time.

    Author:
    Teodor Danciu (teodord@users.sourceforge.net)