Package org.apache.jasper.compiler
Class TextOptimizer.TextCatVisitor
- java.lang.Object
-
- org.apache.jasper.compiler.Node.Visitor
-
- org.apache.jasper.compiler.TextOptimizer.TextCatVisitor
-
- Enclosing class:
- TextOptimizer
static class TextOptimizer.TextCatVisitor extends Node.Visitor
A visitor to concatenate contiguous template texts.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringemptyTextprivate Node.TemplateTextfirstTextNodeprivate booleanprePassprivate java.lang.StringBuildertextBufferprivate inttextNodeCountprivate booleantrim
-
Constructor Summary
Constructors Constructor Description TextCatVisitor(boolean prePass, boolean trim)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcollectText()This method breaks concatenation mode.voiddoVisit(Node n)This method provides a place to put actions that are common to all nodes.voidvisit(Node.AttributeDirective n)voidvisit(Node.PageDirective n)voidvisit(Node.TagDirective n)voidvisit(Node.TaglibDirective n)voidvisit(Node.TemplateText n)voidvisit(Node.VariableDirective n)voidvisitBody(Node n)Visit the body of a node, using the current visitor
-
-
-
Field Detail
-
textNodeCount
private int textNodeCount
-
firstTextNode
private Node.TemplateText firstTextNode
-
textBuffer
private java.lang.StringBuilder textBuffer
-
emptyText
private final java.lang.String emptyText
-
prePass
private boolean prePass
-
trim
private boolean trim
-
-
Method Detail
-
doVisit
public void doVisit(Node n) throws JasperException
Description copied from class:Node.VisitorThis method provides a place to put actions that are common to all nodes. Override this in the child visitor class if need to.- Overrides:
doVisitin classNode.Visitor- Throws:
JasperException
-
visit
public void visit(Node.PageDirective n) throws JasperException
- Overrides:
visitin classNode.Visitor- Throws:
JasperException
-
visit
public void visit(Node.TagDirective n) throws JasperException
- Overrides:
visitin classNode.Visitor- Throws:
JasperException
-
visit
public void visit(Node.TaglibDirective n) throws JasperException
- Overrides:
visitin classNode.Visitor- Throws:
JasperException
-
visit
public void visit(Node.AttributeDirective n) throws JasperException
- Overrides:
visitin classNode.Visitor- Throws:
JasperException
-
visit
public void visit(Node.VariableDirective n) throws JasperException
- Overrides:
visitin classNode.Visitor- Throws:
JasperException
-
visitBody
public void visitBody(Node n) throws JasperException
Description copied from class:Node.VisitorVisit the body of a node, using the current visitor- Overrides:
visitBodyin classNode.Visitor- Throws:
JasperException
-
visit
public void visit(Node.TemplateText n) throws JasperException
- Overrides:
visitin classNode.Visitor- Throws:
JasperException
-
collectText
private void collectText()
This method breaks concatenation mode. As a side effect it copies the concatenated string to the first text node
-
-