public final class MsgNode extends AbstractBlockCommandNode implements SoyNode.ExprHolderNode, SoyNode.MsgBlockNode
Important: Do not use outside of Soy code (treat as superpackage-private).
| Modifier and Type | Class and Description |
|---|---|
static class |
MsgNode.Builder
Builder for
MsgNode. |
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| Modifier and Type | Method and Description |
|---|---|
MsgNode |
clone()
Copies this node.
|
static MsgNode.Builder |
fallbackmsg(int id,
String commandText,
SourceLocation sourceLocation)
Returns a new
MsgNode.Builder representing a fallbackmsg MsgNode. |
List<ExprUnion> |
getAllExprUnions()
Returns the list of expressions in this node.
|
List<ExprRootNode<?>> |
getAndRemoveGenderExprs()
Returns the list of expressions for gender values and sets that field to null.
|
String |
getContentType()
Returns the content type for the TC.
|
String |
getDesc()
Returns the description string for translators.
|
SoyNode.Kind |
getKind()
Returns this node's kind (corresponding to this node's specific type).
|
String |
getMeaning()
Returns the meaning string if set, otherwise null (usually null).
|
String |
getPlaceholderName(MsgPlaceholderNode placeholderNode)
Gets the placeholder name for a given placeholder node.
|
String |
getPluralVarName(MsgPluralNode pluralNode)
Gets the variable name associated with a given plural node.
|
MsgPlaceholderNode |
getRepPlaceholderNode(String placeholderName)
Gets the representative placeholder node for a given placeholder name.
|
MsgPluralNode |
getRepPluralNode(String pluralVarName)
Gets the representative plural node for a given plural variable name.
|
MsgSelectNode |
getRepSelectNode(String selectVarName)
Gets the representative select node for a given select variable name.
|
String |
getSelectVarName(MsgSelectNode selectNode)
Gets the variable name associated with a given select node.
|
com.google.common.collect.ImmutableMap<String,SoyNode.MsgSubstUnitNode> |
getVarNameToRepNodeMap()
Getter for the generated map from substitution unit var name to representative node.
|
boolean |
isHidden()
Returns whether the message should be added as 'hidden' in the TC.
|
boolean |
isPlrselMsg()
Returns whether this is a plural or select message.
|
boolean |
isPluralMsg()
Returns whether this is a plural message.
|
boolean |
isRawTextMsg()
Returns whether this is a raw text message.
|
boolean |
isSelectMsg()
Returns whether this is a select message.
|
static MsgNode.Builder |
msg(int id,
String commandText,
SourceLocation sourceLocation)
Returns a new
MsgNode.Builder representing a msg MsgNode. |
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, getCommandName, getCommandText, getTagStringgetId, getParent, getSourceLocation, setId, setSourceLocation, toStringcouldHaveSyntaxVersionAtLeast, getNearestAncestor, getSyntaxVersionBound, hasAncestor, maybeSetSyntaxVersionBound, setParentequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetId, getSourceLocation, setId, setSourceLocationaddChild, addChild, addChildren, addChildren, appendSourceStringForChildren, appendTreeStringForChildren, clearChildren, getChild, getChildIndex, getChildren, numChildren, removeChild, removeChild, replaceChild, replaceChildcouldHaveSyntaxVersionAtLeast, getNearestAncestor, getSyntaxVersionBound, hasAncestor, maybeSetSyntaxVersionBound, setParent, toTreeStringgetCommandName, getCommandText, getTagStringpublic static MsgNode.Builder msg(int id, String commandText, SourceLocation sourceLocation)
MsgNode.Builder representing a msg MsgNode.id - The node's id.commandText - The node's command text.sourceLocation - The node's source location.public static MsgNode.Builder fallbackmsg(int id, String commandText, SourceLocation sourceLocation)
MsgNode.Builder representing a fallbackmsg MsgNode.id - The node's id.commandText - The node's command text.sourceLocation - The node's source location.public SoyNode.Kind getKind()
SoyNode@Nullable public List<ExprRootNode<?>> getAndRemoveGenderExprs()
public List<ExprUnion> getAllExprUnions()
SoyNode.ExprHolderNodegetAllExprUnions in interface SoyNode.ExprHolderNodepublic String getMeaning()
public String getDesc()
public boolean isHidden()
public String getContentType()
public boolean isPlrselMsg()
public boolean isSelectMsg()
public boolean isPluralMsg()
public boolean isRawTextMsg()
public MsgPlaceholderNode getRepPlaceholderNode(String placeholderName)
placeholderName - The placeholder name.public String getPlaceholderName(MsgPlaceholderNode placeholderNode)
placeholderNode - The placeholder node.public MsgPluralNode getRepPluralNode(String pluralVarName)
pluralVarName - The plural variable name.public String getPluralVarName(MsgPluralNode pluralNode)
pluralNode - The plural node.public MsgSelectNode getRepSelectNode(String selectVarName)
selectVarName - The select variable name.public String getSelectVarName(MsgSelectNode selectNode)
selectNode - The select node.public com.google.common.collect.ImmutableMap<String,SoyNode.MsgSubstUnitNode> getVarNameToRepNodeMap()
public String toSourceString()
NodetoSourceString in interface NodetoSourceString in class AbstractParentCommandNode<SoyNode.StandaloneNode>public MsgNode 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.