public abstract class TemplateNode extends AbstractSoyNode implements SoyNode.RenderUnitNode
Important: Do not use outside of Soy code (treat as superpackage-private).
| Modifier and Type | Class and Description |
|---|---|
static class |
TemplateNode.Priority
Priority for delegate templates.
|
static class |
TemplateNode.SoyFileHeaderInfo
Info from the containing Soy file's
delpackage and namespace declarations. |
SoyNode.BlockCommandNode, SoyNode.BlockNode, SoyNode.CommandNode, SoyNode.ConditionalBlockNode, SoyNode.ExprHolderNode, SoyNode.Kind, SoyNode.LocalVarBlockNode, SoyNode.LocalVarInlineNode, SoyNode.LocalVarNode, SoyNode.MsgBlockNode, SoyNode.MsgPlaceholderInitialNode, SoyNode.MsgSubstUnitNode, SoyNode.ParentSoyNode<N extends SoyNode>, SoyNode.RenderUnitNode, SoyNode.SplitLevelTopNode<N extends SoyNode>, SoyNode.StandaloneNode, SoyNode.StatementNode| Modifier | Constructor and Description |
|---|---|
protected |
TemplateNode(TemplateNode orig,
CopyState copyState)
Copy constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChild(int index,
N child)
Adds the given child at the given index (shifting existing children if necessary).
|
void |
addChild(N child)
Adds the given child.
|
void |
addChildren(int index,
List<? extends N> children)
Adds the given children at the given index (shifting existing children if necessary).
|
void |
addChildren(List<? extends N> children)
Adds the given children.
|
void |
appendSourceStringForChildren(StringBuilder sb)
Appends the source strings for all the children to the given StringBuilder.
|
void |
clearChildren()
Clears the list of children.
|
void |
clearSoyDocStrings()
Clears the SoyDoc text, description, and param descriptions.
|
StackTraceElement |
createStackTraceElement(SourceLocation srcLocation)
Construct a StackTraceElement that will point to the given source location of the current
template.
|
Iterable<TemplateParam> |
getAllParams()
Returns all params from template header or SoyDoc, both regular and injected.
|
AutoescapeMode |
getAutoescapeMode()
Returns the mode of autoescaping.
|
N |
getChild(int index)
Gets the child at the given index.
|
int |
getChildIndex(Node child)
Finds the index of the given child.
|
List<N> |
getChildren()
Gets the list of children.
|
String |
getCommandName()
Returns the Soy command name.
|
String |
getCommandText()
Returns the command text (may be the empty string).
|
SanitizedContentKind |
getContentKind()
Returns the content kind for strict autoescaping.
|
String |
getCssBaseNamespace()
Returns the base CSS namespace for resolving package-relative class names.
|
String |
getDelPackageName()
Returns the name of the containing delegate package, or null if none.
|
com.google.common.collect.ImmutableList<TemplateParam> |
getInjectedParams()
Returns the injected params from template header.
|
int |
getMaxLocalVariableTableSize() |
com.google.common.collect.ImmutableList<TemplateParam> |
getParams()
Returns the params from template header or SoyDoc.
|
SoyFileNode |
getParent()
Gets this node's parent.
|
String |
getPartialTemplateName()
Returns this template's partial name.
|
com.google.common.collect.ImmutableList<String> |
getRequiredCssNamespaces()
Returns required CSS namespaces.
|
String |
getSoyDoc()
Returns the SoyDoc, or null.
|
String |
getSoyDocDesc()
Returns the description portion of the SoyDoc (before @param tags), or null.
|
TemplateNode.SoyFileHeaderInfo |
getSoyFileHeaderInfo()
Returns info from the containing Soy file's header declarations.
|
protected String |
getTagString() |
protected String |
getTagString(boolean selfEnding) |
String |
getTemplateName()
Returns this template's name.
|
abstract String |
getTemplateNameForUserMsgs()
Returns a template name suitable for display in user msgs.
|
Visibility |
getVisibility()
Returns the visibility of this template.
|
boolean |
isStrictHtml()
Returns if this template is in strict html mode.
|
int |
numChildren()
Gets the number of children.
|
void |
removeChild(int index)
Removes the child at the given index.
|
void |
removeChild(N child)
Removes the given child.
|
void |
replaceChild(int index,
N newChild)
Replaces the child at the given index with the given new child.
|
void |
replaceChild(N currChild,
N newChild)
Replaces the given current child with the given new child.
|
void |
setMaxLocalVariableTableSize(int size) |
String |
toSourceString()
Builds a Soy source string that could be the source for this node.
|
getId, getSourceLocation, setId, toStringcouldHaveSyntaxVersionAtLeast, equals, getNearestAncestor, getSyntaxVersionUpperBound, hasAncestor, hashCode, maybeSetSyntaxVersionUpperBound, setParentclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetCommandNamecopy, getId, getKind, setIdaddChild, addChild, addChildren, addChildren, appendSourceStringForChildren, clearChildren, getChild, getChildIndex, getChildren, numChildren, removeChild, removeChild, replaceChild, replaceChildcouldHaveSyntaxVersionAtLeast, getNearestAncestor, getSourceLocation, getSyntaxVersionUpperBound, hasAncestor, maybeSetSyntaxVersionUpperBound, setParentprotected TemplateNode(TemplateNode orig, CopyState copyState)
orig - The node to copy.public TemplateNode.SoyFileHeaderInfo getSoyFileHeaderInfo()
public String getDelPackageName()
public abstract String getTemplateNameForUserMsgs()
public String getTemplateName()
@Nullable public String getPartialTemplateName()
public Visibility getVisibility()
public AutoescapeMode getAutoescapeMode()
public boolean isStrictHtml()
@Nullable public SanitizedContentKind getContentKind()
getContentKind in interface SoyNode.RenderUnitNodepublic com.google.common.collect.ImmutableList<String> getRequiredCssNamespaces()
CSS "namespaces" are monikers associated with CSS files that by convention, dot-separated lowercase names. They don't correspond to CSS features, but are processed by external tools that impose dependencies from templates to CSS.
public String getCssBaseNamespace()
Packages are defined using dotted-id syntax (foo.bar), which is identical to the syntax for required CSS namespaces. If no base CSS namespace is defined, it will use the first required css namespace, if any are present. If there is no base CSS name, and no required css namespaces, then use of package-relative class names will be reported as an error.
public void setMaxLocalVariableTableSize(int size)
public int getMaxLocalVariableTableSize()
public void clearSoyDocStrings()
@Nullable public String getSoyDocDesc()
public com.google.common.collect.ImmutableList<TemplateParam> getParams()
public com.google.common.collect.ImmutableList<TemplateParam> getInjectedParams()
@Nullable public Iterable<TemplateParam> getAllParams()
public SoyFileNode getParent()
Nodepublic String getCommandText()
SoyNode.CommandNodegetCommandText in interface SoyNode.CommandNodepublic String toSourceString()
NodeNote: Some nodes do not have a direct mapping to Soy source (such as nodes created during some optimization passes). Thus this method may not always be supported.
toSourceString in interface Nodepublic StackTraceElement createStackTraceElement(SourceLocation srcLocation)
public int numChildren()
ParentNodenumChildren in interface ParentNode<N extends SoyNode>public N getChild(int index)
ParentNodegetChild in interface ParentNode<N extends SoyNode>index - The index of the child to get.public int getChildIndex(Node child)
ParentNodegetChildIndex in interface ParentNode<N extends SoyNode>child - The child to find the index of.public List<N> getChildren()
ParentNodeNote: The returned list may not be a copy. Please do not modify the list directly. Instead, use the other methods in this class that are intended for modifying children. Also, if you're iterating over the children list as you're modifying it, then you should first make a copy of the children list to iterate over, in order to avoid ConcurrentModificationException.
getChildren in interface ParentNode<N extends SoyNode>public void addChild(N child)
ParentNodeaddChild in interface ParentNode<N extends SoyNode>child - The child to add.public void addChild(int index,
N child)
ParentNodeaddChild in interface ParentNode<N extends SoyNode>index - The index to add the child at.child - The child to add.public void removeChild(int index)
ParentNoderemoveChild in interface ParentNode<N extends SoyNode>index - The index of the child to remove.public void removeChild(N child)
ParentNoderemoveChild in interface ParentNode<N extends SoyNode>child - The child to remove.public void replaceChild(int index,
N newChild)
ParentNodereplaceChild in interface ParentNode<N extends SoyNode>index - The index of the child to replace.newChild - The new child.public void replaceChild(N currChild,
N newChild)
ParentNodereplaceChild in interface ParentNode<N extends SoyNode>currChild - The current child to be replaced.newChild - The new child.public void clearChildren()
ParentNodeclearChildren in interface ParentNode<N extends SoyNode>public void addChildren(List<? extends N> children)
ParentNodeaddChildren in interface ParentNode<N extends SoyNode>children - The children to add.public void addChildren(int index,
List<? extends N> children)
ParentNodeaddChildren in interface ParentNode<N extends SoyNode>index - The index to add the children at.children - The children to add.public void appendSourceStringForChildren(StringBuilder sb)
ParentNodeappendSourceStringForChildren in interface ParentNode<N extends SoyNode>sb - The StringBuilder to which to append the children's source strings.public String getCommandName()
SoyNode.CommandNodegetCommandName in interface SoyNode.CommandNodeprotected String getTagString()
protected final String getTagString(boolean selfEnding)