public class StringConversionNode extends Node
A StringConversionNode
does not correspond to any tree node in the parsed AST. It is
introduced when a value of non-string type appears in a context that requires a String
,
such as in a string concatenation. A StringConversionNode
should be treated as a
potential call to the toString method of its operand, but does not necessarily call any method
because null is converted to the string "null".
Conversion of primitive types to Strings requires first boxing and then string conversion.
Modifier and Type | Field and Description |
---|---|
protected Node |
operand |
protected Tree |
tree |
Constructor and Description |
---|
StringConversionNode(Tree tree,
Node operand,
TypeMirror type) |
Modifier and Type | Method and Description |
---|---|
<R,P> R |
accept(NodeVisitor<R,P> visitor,
P p)
Accept method of the visitor pattern.
|
boolean |
equals(@Nullable Object obj) |
Node |
getOperand() |
Collection<Node> |
getOperands()
|
Tree |
getTree()
Returns the
Tree in the abstract syntax tree, or null if no corresponding
tree exists. |
int |
hashCode() |
String |
toString() |
getAssignmentContext, getBlock, getInSource, getTransitiveOperands, getType, getUid, isLValue, nodeCollectionToString, setAssignmentContext, setBlock, setInSource, setLValue, toStringDebug
public StringConversionNode(Tree tree, Node operand, TypeMirror type)
public Node getOperand()
public Tree getTree()
Node
Tree
in the abstract syntax tree, or null
if no corresponding
tree exists. For instance, this is the case for an ImplicitThisNode
.public <R,P> R accept(NodeVisitor<R,P> visitor, P p)
Node
public Collection<Node> getOperands()
Node
getOperands
in class Node
Node
s of this Node