FileDocCategorySizeDatePackage
ELFunctionMapper.javaAPI DocApache Tomcat 6.0.1410537Fri Jul 20 04:20:34 BST 2007org.apache.jasper.compiler

ELFunctionMapper

public class ELFunctionMapper extends Object
This class generates functions mappers for the EL expressions in the page. Instead of a global mapper, a mapper is used for ecah call to EL evaluator, thus avoiding the prefix overlapping and redefinition issues.
author
Kin-man Chung

Fields Summary
private int
currFunc
StringBuffer
ds
StringBuffer
ss
Constructors Summary
Methods Summary
public static voidmap(Compiler compiler, Node.Nodes page)
Creates the functions mappers for all EL expressions in the JSP page.

param
compiler Current compiler, mainly for accessing error dispatcher.
param
page The current compilation unit.

  // Contains declarations of the functions mappers.

                                    
           
                  

        ELFunctionMapper map = new ELFunctionMapper();
        map.ds = new StringBuffer();
        map.ss = new StringBuffer();

        page.visit(map.new ELFunctionVisitor());

        // Append the declarations to the root node
        String ds = map.ds.toString();
        if (ds.length() > 0) {
            Node root = page.getRoot();
            new Node.Declaration(map.ss.toString(), null, root);
            new Node.Declaration("static {\n" + ds + "}\n", null, root);
        }