public final class XidNode extends AbstractSoyNode implements SoyNode.StandaloneNode, SoyNode.StatementNode
Important: Do not use outside of Soy code (treat as superpackage-private).
| Modifier and Type | Class and Description |
|---|---|
static class |
XidNode.Builder
Builder for
XidNode. |
SoyNode.BlockCommandNode, SoyNode.BlockNode, SoyNode.CommandNode, SoyNode.ConditionalBlockNode, SoyNode.ExprHolderNode, SoyNode.Kind, SoyNode.LocalVarBlockNode, SoyNode.LocalVarInlineNode, SoyNode.LocalVarNode, SoyNode.LoopNode, SoyNode.MsgBlockNode, SoyNode.MsgPlaceholderInitialNode, SoyNode.MsgSubstUnitNode, SoyNode.ParentSoyNode<N extends SoyNode>, SoyNode.RenderUnitNode, SoyNode.SplitLevelTopNode<N extends SoyNode>, SoyNode.StandaloneNode, SoyNode.StatementNodeSPACES| Constructor and Description |
|---|
XidNode(int id,
SourceLocation sourceLocation,
String commandText) |
| Modifier and Type | Method and Description |
|---|---|
protected String |
buildTagStringHelper(boolean isSelfEnding)
Helper to build the source tag string (usually for testing/debugging).
|
protected String |
buildTagStringHelper(boolean isSelfEnding,
boolean isImplicitCommandName)
Helper to build the source tag string (usually for testing/debugging).
|
XidNode |
copy(CopyState copyState)
Copies this node.
|
String |
getCommandName()
May be overridden by subclasses to keep consistent with tree modifications.
|
String |
getCommandText()
May be overridden by subclasses to keep consistent with tree modifications.
|
SoyNode.Kind |
getKind()
Returns this node's kind (corresponding to this node's specific type).
|
SoyNode.BlockNode |
getParent()
Gets this node's parent.
|
String |
getRenamedText(SoyIdRenamingMap idRenamingMap) |
String |
getTagString()
Builds a Soy tag string that could be the Soy tag for this node.
|
String |
getText()
Returns the text of the identifier.
|
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, waitcouldHaveSyntaxVersionAtLeast, getNearestAncestor, getSourceLocation, getSyntaxVersionUpperBound, hasAncestor, maybeSetSyntaxVersionUpperBound, setParent, toSourceStringpublic XidNode(int id,
SourceLocation sourceLocation,
String commandText)
id - The id for this node.commandText - The command text.public SoyNode.Kind getKind()
SoyNodepublic String getText()
public String getRenamedText(SoyIdRenamingMap idRenamingMap)
public SoyNode.BlockNode getParent()
NodegetParent in interface NodegetParent in interface SoyNodegetParent in interface SoyNode.StandaloneNodegetParent in class AbstractSoyNodepublic XidNode copy(CopyState copyState)
SoyNodeAll copy() overrides should follow this contract:
{@literal @}Override public T copy(CopyState copyState) {
return new T(this, copyState);
}
TODO(lukes): The usecases for a copy method are few and far between. Making the AST nodes immutable (or at least unmodifiable) would be preferable to maintaining our copy() methods.
Don't clone nodes unless you know what you're doing. The Soy AST is not actually a tree (it contains back edges from variables to their definitions), and naively copying nodes can result in pointers into stale ASTs
The copied nodes will have the same ids as the original nodes. If you need to copy a
subtree with new ids assigned to the copied nodes, use SoytreeUtils.cloneWithNewIds(T, com.google.template.soy.base.internal.IdGenerator).
public String getCommandName()
getCommandName in interface SoyNode.CommandNodepublic String getCommandText()
getCommandText in interface SoyNode.CommandNodepublic String getTagString()
SoyNode.CommandNodegetTagString in interface SoyNode.CommandNodeprotected String buildTagStringHelper(boolean isSelfEnding)
isSelfEnding - Whether the tag is self-ending, i.e. { ... /}.protected String buildTagStringHelper(boolean isSelfEnding, boolean isImplicitCommandName)
isSelfEnding - Whether the tag is self-ending, i.e. { ... /}.isImplicitCommandName - Whether the command name is implicit, e.g. a 'print' tag without
the explicit 'print'.public String toSourceString()
NodetoSourceString in interface Node