com.google.template.soy.soytree
Class AbstractSoyNodeVisitor<R>

java.lang.Object
  extended by com.google.template.soy.basetree.AbstractNodeVisitor<SoyNode,R>
      extended by com.google.template.soy.soytree.AbstractSoyNodeVisitor<R>
Type Parameters:
R - The return type of this visitor.
All Implemented Interfaces:
NodeVisitor<SoyNode,R>
Direct Known Subclasses:
AssertNoExternalCallsVisitor, AssertSyntaxVersionV2Visitor, BuildAllDependeesMapVisitor, ChangeCallsToPassAllDataVisitor, CheckCallsVisitor, CheckDelegatesVisitor, CheckEscapingSanityVisitor, CheckFunctionCallsVisitor, CheckOverridesVisitor, CheckSoyDocVisitor, ClearSoyDocStringsVisitor, CombineConsecutiveRawTextNodesVisitor, ExtractMsgsVisitor, FindIjParamsVisitor, FindIndirectParamsVisitor, GenerateParseInfoVisitor, GenJavaExprsVisitor, GenJsExprsVisitor, HandleCssCommandVisitor, HasPlrselMsgVisitor, InsertMsgsVisitor, MarkLocalVarDataRefsVisitor, PerformAutoescapeVisitor, RemoveHtmlCommentsVisitor, RenameCssVisitor, RenderVisitor, RewriteRemainderNodesVisitor, SetFullCalleeNamesVisitor, SimplifyVisitor, UnmarkLocalVarDataRefsVisitor, VerifyPhnameAttrOnlyOnPlaceholdersVisitor

public abstract class AbstractSoyNodeVisitor<R>
extends AbstractNodeVisitor<SoyNode,R>

Abstract base class for all SoyNode visitors. A visitor is basically a function implemented for some or all SoyNodes, where the implementation can be different for each specific node class.

Same as AbstractReturningSoyNodeVisitor except that in this class, internal visit() calls do not return a value.

Important: Do not use outside of Soy code (treat as superpackage-private).

To create a visitor:

  1. Subclass this class.
  2. Implement visit*Node() methods for some specific node types.
  3. Implement fallback methods for node types not specifically handled. The most general fallback method is visitSoyNode(), which is usually needed. Other fallback methods include visitLoopNode() and visitCallParamNode().
  4. Maybe implement a constructor, taking appropriate parameters for your visitor call.
  5. Maybe implement exec() if this visitor needs to return a non-null final result and/or if this visitor has state that needs to be setup/reset before each unrelated use of visit().

See Also:
AbstractReturningSoyNodeVisitor

Constructor Summary
AbstractSoyNodeVisitor()
           
 
Method Summary
protected  void visit(SoyNode node)
          Visits the given node to execute the function defined by this visitor.
protected  void visitCallBasicNode(CallBasicNode node)
           
protected  void visitCallDelegateNode(CallDelegateNode node)
           
protected  void visitCallNode(CallNode node)
           
protected  void visitCallParamContentNode(CallParamContentNode node)
           
protected  void visitCallParamNode(CallParamNode node)
           
protected  void visitCallParamValueNode(CallParamValueNode node)
           
protected  void visitChildren(SoyNode.ParentSoyNode<?> node)
          Helper to visit all the children of a node, in order.
protected  void visitChildrenAllowingConcurrentModification(SoyNode.ParentSoyNode<?> node)
          Helper to visit all the children of a node, in order.
protected  void visitCssNode(CssNode node)
           
protected  void visitDebuggerNode(DebuggerNode node)
           
protected  void visitForeachIfemptyNode(ForeachIfemptyNode node)
           
protected  void visitForeachNode(ForeachNode node)
           
protected  void visitForeachNonemptyNode(ForeachNonemptyNode node)
           
protected  void visitForNode(ForNode node)
           
protected  void visitGoogMsgNode(GoogMsgNode node)
           
protected  void visitGoogMsgRefNode(GoogMsgRefNode node)
           
protected  void visitIfCondNode(IfCondNode node)
           
protected  void visitIfElseNode(IfElseNode node)
           
protected  void visitIfNode(IfNode node)
           
protected  void visitLetContentNode(LetContentNode node)
           
protected  void visitLetNode(LetNode node)
           
protected  void visitLetValueNode(LetValueNode node)
           
protected  void visitLogNode(LogNode node)
           
protected  void visitLoopNode(SoyNode.LoopNode node)
           
protected  void visitMsgHtmlTagNode(MsgHtmlTagNode node)
           
protected  void visitMsgNode(MsgNode node)
           
protected  void visitMsgPlaceholderNode(MsgPlaceholderNode node)
           
protected  void visitMsgPluralCaseNode(MsgPluralCaseNode node)
           
protected  void visitMsgPluralDefaultNode(MsgPluralDefaultNode node)
           
protected  void visitMsgPluralNode(MsgPluralNode node)
           
protected  void visitMsgPluralRemainderNode(MsgPluralRemainderNode node)
           
protected  void visitMsgSelectCaseNode(MsgSelectCaseNode node)
           
protected  void visitMsgSelectDefaultNode(MsgSelectDefaultNode node)
           
protected  void visitMsgSelectNode(MsgSelectNode node)
           
protected  void visitPrintDirectiveNode(PrintDirectiveNode node)
           
protected  void visitPrintNode(PrintNode node)
           
protected  void visitRawTextNode(RawTextNode node)
           
protected  void visitSoyFileNode(SoyFileNode node)
           
protected  void visitSoyFileSetNode(SoyFileSetNode node)
           
protected  void visitSoyNode(SoyNode node)
           
protected  void visitSwitchCaseNode(SwitchCaseNode node)
           
protected  void visitSwitchDefaultNode(SwitchDefaultNode node)
           
protected  void visitSwitchNode(SwitchNode node)
           
protected  void visitTemplateBasicNode(TemplateBasicNode node)
           
protected  void visitTemplateDelegateNode(TemplateDelegateNode node)
           
protected  void visitTemplateNode(TemplateNode node)
           
 
Methods inherited from class com.google.template.soy.basetree.AbstractNodeVisitor
exec, visitChildren, visitChildrenAllowingConcurrentModification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSoyNodeVisitor

public AbstractSoyNodeVisitor()
Method Detail

visit

protected void visit(SoyNode node)
Description copied from class: AbstractNodeVisitor
Visits the given node to execute the function defined by this visitor.

Specified by:
visit in class AbstractNodeVisitor<SoyNode,R>
Parameters:
node - The node to visit.

visitChildren

protected void visitChildren(SoyNode.ParentSoyNode<?> node)
Helper to visit all the children of a node, in order.

Parameters:
node - The parent node whose children to visit.
See Also:
visitChildrenAllowingConcurrentModification(com.google.template.soy.soytree.SoyNode.ParentSoyNode)

visitChildrenAllowingConcurrentModification

protected void visitChildrenAllowingConcurrentModification(SoyNode.ParentSoyNode<?> node)
Helper to visit all the children of a node, in order. This method differs from visitChildren in that we are iterating through a copy of the children. Thus, concurrent modification of the list of children is allowed.

Parameters:
node - The parent node whose children to visit.
See Also:
visitChildren(com.google.template.soy.soytree.SoyNode.ParentSoyNode)

visitSoyFileSetNode

protected void visitSoyFileSetNode(SoyFileSetNode node)

visitSoyFileNode

protected void visitSoyFileNode(SoyFileNode node)

visitTemplateBasicNode

protected void visitTemplateBasicNode(TemplateBasicNode node)

visitTemplateDelegateNode

protected void visitTemplateDelegateNode(TemplateDelegateNode node)

visitTemplateNode

protected void visitTemplateNode(TemplateNode node)

visitRawTextNode

protected void visitRawTextNode(RawTextNode node)

visitGoogMsgNode

protected void visitGoogMsgNode(GoogMsgNode node)

visitGoogMsgRefNode

protected void visitGoogMsgRefNode(GoogMsgRefNode node)

visitMsgNode

protected void visitMsgNode(MsgNode node)

visitMsgPluralNode

protected void visitMsgPluralNode(MsgPluralNode node)

visitMsgPluralCaseNode

protected void visitMsgPluralCaseNode(MsgPluralCaseNode node)

visitMsgPluralDefaultNode

protected void visitMsgPluralDefaultNode(MsgPluralDefaultNode node)

visitMsgPluralRemainderNode

protected void visitMsgPluralRemainderNode(MsgPluralRemainderNode node)

visitMsgSelectNode

protected void visitMsgSelectNode(MsgSelectNode node)

visitMsgSelectCaseNode

protected void visitMsgSelectCaseNode(MsgSelectCaseNode node)

visitMsgSelectDefaultNode

protected void visitMsgSelectDefaultNode(MsgSelectDefaultNode node)

visitMsgPlaceholderNode

protected void visitMsgPlaceholderNode(MsgPlaceholderNode node)

visitMsgHtmlTagNode

protected void visitMsgHtmlTagNode(MsgHtmlTagNode node)

visitPrintNode

protected void visitPrintNode(PrintNode node)

visitPrintDirectiveNode

protected void visitPrintDirectiveNode(PrintDirectiveNode node)

visitCssNode

protected void visitCssNode(CssNode node)

visitLetValueNode

protected void visitLetValueNode(LetValueNode node)

visitLetContentNode

protected void visitLetContentNode(LetContentNode node)

visitLetNode

protected void visitLetNode(LetNode node)

visitIfNode

protected void visitIfNode(IfNode node)

visitIfCondNode

protected void visitIfCondNode(IfCondNode node)

visitIfElseNode

protected void visitIfElseNode(IfElseNode node)

visitSwitchNode

protected void visitSwitchNode(SwitchNode node)

visitSwitchCaseNode

protected void visitSwitchCaseNode(SwitchCaseNode node)

visitSwitchDefaultNode

protected void visitSwitchDefaultNode(SwitchDefaultNode node)

visitForeachNode

protected void visitForeachNode(ForeachNode node)

visitForeachIfemptyNode

protected void visitForeachIfemptyNode(ForeachIfemptyNode node)

visitForeachNonemptyNode

protected void visitForeachNonemptyNode(ForeachNonemptyNode node)

visitForNode

protected void visitForNode(ForNode node)

visitLoopNode

protected void visitLoopNode(SoyNode.LoopNode node)

visitCallBasicNode

protected void visitCallBasicNode(CallBasicNode node)

visitCallDelegateNode

protected void visitCallDelegateNode(CallDelegateNode node)

visitCallNode

protected void visitCallNode(CallNode node)

visitCallParamValueNode

protected void visitCallParamValueNode(CallParamValueNode node)

visitCallParamContentNode

protected void visitCallParamContentNode(CallParamContentNode node)

visitCallParamNode

protected void visitCallParamNode(CallParamNode node)

visitLogNode

protected void visitLogNode(LogNode node)

visitDebuggerNode

protected void visitDebuggerNode(DebuggerNode node)

visitSoyNode

protected void visitSoyNode(SoyNode node)
Parameters:
node - the visited node.