com.google.template.soy.exprtree
Class DataRefNode

java.lang.Object
  extended by com.google.template.soy.basetree.AbstractNode
      extended by com.google.template.soy.exprtree.AbstractExprNode
          extended by com.google.template.soy.exprtree.AbstractParentExprNode
              extended by com.google.template.soy.exprtree.DataRefNode
All Implemented Interfaces:
Node, ParentNode<ExprNode>, ExprNode, ExprNode.ParentExprNode

public class DataRefNode
extends AbstractParentExprNode

Node representing a data reference.

Important: Do not use outside of Soy code (treat as superpackage-private).

The first key is stored as a field in the node. The remaining accesses, if any, are children of the node. Each child must be a DataRefAccessNode (of which there are 3 subtypes).


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.google.template.soy.exprtree.ExprNode
ExprNode.ConstantNode, ExprNode.Kind, ExprNode.OperatorNode, ExprNode.ParentExprNode, ExprNode.PrimitiveNode
 
Field Summary
 
Fields inherited from class com.google.template.soy.basetree.AbstractNode
SPACES
 
Constructor Summary
  DataRefNode(boolean isIjDataRef, boolean isNullSafeIjDataRef, String firstKey)
           
protected DataRefNode(DataRefNode orig)
          Copy constructor.
 
Method Summary
 DataRefNode clone()
          Clones this node.
 String getFirstKey()
          Returns the first key.
 ExprNode.Kind getKind()
          Gets this node's kind (corresponding to this node's specific type).
 boolean isIjDataRef()
          Returns whether this node is a reference to injected data.
 Boolean isLocalVarDataRef()
          Returns whether this node is a reference to local var data, or null if unknown.
 boolean isNullSafeIjDataRef()
          Returns whether this node is a null-safe reference to injected data.
 void setIsLocalVarDataRef(Boolean isLocalVarDataRef)
          Sets whether this node is a reference to local var data, or null if unknown.
 String toSourceString()
          Builds a Soy source string that could be the source for this node.
 
Methods inherited from class com.google.template.soy.exprtree.AbstractParentExprNode
addChild, addChild, addChildren, addChildren, appendSourceStringForChildren, appendTreeStringForChildren, clearChildren, getChild, getChildIndex, getChildren, numChildren, removeChild, removeChild, replaceChild, replaceChild, toTreeString
 
Methods inherited from class com.google.template.soy.exprtree.AbstractExprNode
getParent
 
Methods inherited from class com.google.template.soy.basetree.AbstractNode
getNearestAncestor, hasAncestor, setParent, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.template.soy.exprtree.ExprNode
getParent
 
Methods inherited from interface com.google.template.soy.basetree.Node
getNearestAncestor, hasAncestor, setParent
 

Constructor Detail

DataRefNode

public DataRefNode(boolean isIjDataRef,
                   boolean isNullSafeIjDataRef,
                   String firstKey)
Parameters:
isIjDataRef - Whether this node is a reference to injected data.
isNullSafeIjDataRef - Whether this node is a null-safe reference to injected data.
firstKey - The first key.

DataRefNode

protected DataRefNode(DataRefNode orig)
Copy constructor.

Parameters:
orig - The node to copy.
Method Detail

getKind

public ExprNode.Kind getKind()
Description copied from interface: ExprNode
Gets this node's kind (corresponding to this node's specific type).

Returns:
This node's kind (corresponding to this node's specific type).

isIjDataRef

public boolean isIjDataRef()
Returns whether this node is a reference to injected data.


isNullSafeIjDataRef

public boolean isNullSafeIjDataRef()
Returns whether this node is a null-safe reference to injected data.


setIsLocalVarDataRef

public void setIsLocalVarDataRef(Boolean isLocalVarDataRef)
Sets whether this node is a reference to local var data, or null if unknown.


isLocalVarDataRef

public Boolean isLocalVarDataRef()
Returns whether this node is a reference to local var data, or null if unknown.


getFirstKey

public String getFirstKey()
Returns the first key.


toSourceString

public String toSourceString()
Description copied from interface: Node
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) 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.

Returns:
A Soy string that could be the source for this node.

clone

public DataRefNode clone()
Description copied from interface: Node
Clones this node. The clone's parent pointer is set to null.

Specified by:
clone in interface Node
Specified by:
clone in interface ExprNode
Specified by:
clone in class AbstractExprNode
Returns:
A clone of this code.