public final class PrintNode extends AbstractParentCommandNode<PrintDirectiveNode> implements SoyNode.StandaloneNode, SoyNode.SplitLevelTopNode<PrintDirectiveNode>, SoyNode.StatementNode, SoyNode.ExprHolderNode, SoyNode.MsgPlaceholderInitialNode
Important: Do not use outside of Soy code (treat as superpackage-private).
| Modifier and Type | Field and Description |
|---|---|
static String |
FALLBACK_BASE_PLACEHOLDER_NAME
Fallback base placeholder name.
|
SPACES| Constructor and Description |
|---|
PrintNode(int id,
boolean isImplicit,
ExprUnion exprUnion,
String userSuppliedPlaceholderName)
Constructor for use by passes that want to create a PrintNode with already-parsed expression.
|
PrintNode(int id,
boolean isImplicit,
String exprText,
String userSuppliedPlaceholderName) |
| Modifier and Type | Method and Description |
|---|---|
PrintNode |
clone()
Copies this node.
|
String |
genBasePhName()
Generates the base placeholder name for this node.
|
Object |
genSamenessKey()
Generates the key object used in comparisons to determine whether two placeholder nodes
should be represented by the same placeholder.
|
List<ExprUnion> |
getAllExprUnions()
Returns the list of expressions in this node.
|
String |
getCommandText()
May be overridden by subclasses to keep consistent with tree modifications.
|
String |
getExprText()
Returns the text of the expression to print.
|
ExprUnion |
getExprUnion()
Returns the parsed expression, or null if the expression is not in V2 syntax.
|
SoyNode.Kind |
getKind()
Returns this node's kind (corresponding to this node's specific type).
|
SoyNode.BlockNode |
getParent()
Gets this node's parent.
|
String |
getTagString()
Builds a Soy tag string that could be the Soy tag for this node.
|
String |
getUserSuppliedPhName()
Gets the user-supplied placeholder name, or null if not supplied or not applicable.
|
boolean |
isImplicit()
Returns whether the 'print' command name was implicit.
|
String |
toSourceString()
Builds a Soy source string that could be the source for this node.
|
addChild, addChild, addChildren, addChildren, appendSourceStringForChildren, appendTreeStringForChildren, clearChildren, getChild, getChildIndex, getChildren, numChildren, removeChild, removeChild, replaceChild, replaceChild, toTreeStringbuildTagStringHelper, buildTagStringHelper, getCommandNamegetId, getSourceLocation, setId, setSourceLocation, toStringcouldHaveSyntaxVersionAtLeast, getNearestAncestor, getSyntaxVersionBound, hasAncestor, maybeSetSyntaxVersionBound, setParentequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddChild, addChild, addChildren, addChildren, appendSourceStringForChildren, appendTreeStringForChildren, clearChildren, getChild, getChildIndex, getChildren, numChildren, removeChild, removeChild, replaceChild, replaceChildpublic static final String FALLBACK_BASE_PLACEHOLDER_NAME
public PrintNode(int id,
boolean isImplicit,
String exprText,
@Nullable
String userSuppliedPlaceholderName)
throws SoySyntaxException
id - The id for this node.isImplicit - Whether the command 'print' is implicit.exprText - The text of the expression to print.userSuppliedPlaceholderName - The user-supplied placeholder name, or null if not supplied
or not applicable.SoySyntaxException - If a syntax error is found.public PrintNode(int id,
boolean isImplicit,
ExprUnion exprUnion,
@Nullable
String userSuppliedPlaceholderName)
id - The id for this node.isImplicit - Whether the command 'print' is implicit.exprUnion - The parsed expression.userSuppliedPlaceholderName - The user-supplied placeholder name, or null if not supplied
or not applicable.public SoyNode.Kind getKind()
SoyNodepublic boolean isImplicit()
public String getExprText()
public ExprUnion getExprUnion()
public String getUserSuppliedPhName()
SoyNode.MsgPlaceholderInitialNodegetUserSuppliedPhName in interface SoyNode.MsgPlaceholderInitialNodepublic String genBasePhName()
SoyNode.MsgPlaceholderInitialNodegenBasePhName in interface SoyNode.MsgPlaceholderInitialNodepublic Object genSamenessKey()
SoyNode.MsgPlaceholderInitialNodegenSamenessKey in interface SoyNode.MsgPlaceholderInitialNodepublic List<ExprUnion> getAllExprUnions()
SoyNode.ExprHolderNodegetAllExprUnions in interface SoyNode.ExprHolderNodepublic String getCommandText()
AbstractCommandNodegetCommandText in interface SoyNode.CommandNodegetCommandText in class AbstractCommandNodepublic String getTagString()
SoyNode.CommandNodegetTagString in interface SoyNode.CommandNodegetTagString in class AbstractCommandNodepublic String toSourceString()
NodetoSourceString in interface NodetoSourceString in class AbstractParentCommandNode<PrintDirectiveNode>public SoyNode.BlockNode getParent()
NodegetParent in interface NodegetParent in interface SoyNodegetParent in interface SoyNode.StandaloneNodegetParent in class AbstractSoyNodepublic PrintNode clone()
NodeAll clone() overrides should follow this contract:
{@literal @}Override public T clone() {
return new T(this);
}
NOTE: this means we do not ultimately delegate to Object.clone(), ever.
TODO(lukes): The usecases for a clone method are few and far between. Making the AST nodes immutable (or at least unmodifiable) would be preferable to maintaining our clone() methods.