public final class StringNode extends AbstractExprNode
Important: Do not use outside of Soy code (treat as superpackage-private).
ExprNode.Kind, ExprNode.OperatorNode, ExprNode.ParentExprNode, ExprNode.PrimitiveNode| Constructor and Description |
|---|
StringNode(String value,
QuoteStyle quoteStyle,
SourceLocation sourceLocation) |
| Modifier and Type | Method and Description |
|---|---|
StringNode |
copy(CopyState copyState)
See
Node.copy(CopyState) for a description of the copy contract. |
ExprNode.Kind |
getKind()
Gets this node's kind (corresponding to this node's specific type).
|
StringType |
getType()
Gets the data type of this node.
|
String |
getValue()
Returns the string value.
|
String |
toSourceString()
Equivalent to
toSourceString(false). |
String |
toSourceString(boolean escapeToAscii)
Builds a Soy string literal for this string value (including the surrounding single quotes).
|
getParent, getSourceLocationcouldHaveSyntaxVersionAtLeast, equals, getNearestAncestor, getSyntaxVersionUpperBound, hasAncestor, hashCode, maybeSetSyntaxVersionUpperBound, setParent, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitcouldHaveSyntaxVersionAtLeast, getNearestAncestor, getSourceLocation, getSyntaxVersionUpperBound, hasAncestor, maybeSetSyntaxVersionUpperBound, setParentpublic StringNode(String value, QuoteStyle quoteStyle, SourceLocation sourceLocation)
value - The string value.sourceLocation - The node's source location.public ExprNode.Kind getKind()
ExprNodepublic StringType getType()
ExprNodepublic String getValue()
public String toSourceString()
toSourceString(false).
Builds a Soy source string that could be the source for this node. Note that this is not the actual original source string, but a (SORT OF, NOT QUITE) canonical equivalent.
Note: 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.
public String toSourceString(boolean escapeToAscii)
escapeToAscii - Whether to escape non-ASCII characters as Unicode hex escapes (backslash +
'u' + 4 hex digits).public StringNode copy(CopyState copyState)
ExprNodeNode.copy(CopyState) for a description of the copy contract.