Lombok.ast - v0.2

lombok.ast
Class For

java.lang.Object
  extended by lombok.ast.For
All Implemented Interfaces:
Node, Statement

public class For
extends Object
implements Statement


Constructor Summary
For()
           
 
Method Summary
 void accept(AstVisitor visitor)
           
 Node addMessage(Message message)
           
protected  lombok.ast.AbstractNode adopt(lombok.ast.AbstractNode child)
          Adopts (accepts as direct child) the provided node.
 Expression astCondition()
           
 For astCondition(Expression condition)
           
 StrictListAccessor<Expression,For> astExpressionInits()
           
 Statement astStatement()
           
 For astStatement(Statement statement)
           
 StrictListAccessor<Expression,For> astUpdates()
           
 VariableDefinition astVariableDeclaration()
           
 For astVariableDeclaration(VariableDefinition variableDeclaration)
           
 For copy()
           
 boolean detach(Node child)
          If the provided child node is a child of this node, the child/parent link will be deleted.
protected  void disown(lombok.ast.AbstractNode child)
          Disowns a direct child (it will be parentless after this call).
protected  void ensureParentage(lombok.ast.AbstractNode child)
          Checks if the provided node is a direct child of this node.
protected  void ensureParentless()
          Checks if this node is currently parentless.
 List<Node> getChildren()
           
 Node getGeneratedBy()
          Returns the node that is responsible for generating this node.
 List<Message> getMessages()
           
 boolean hasMessage(String key)
           
 boolean hasParent()
           
 boolean isGenerated()
          Returns true if this node is generated (not actually present in the source).
 boolean isStatementExpressionsBased()
           
 boolean isVariableDeclarationBased()
           
 Node rawCondition()
           
 For rawCondition(Node condition)
           
 RawListAccessor<Expression,For> rawExpressionInits()
           
 Node rawStatement()
           
 For rawStatement(Node statement)
           
 RawListAccessor<Expression,For> rawUpdates()
           
 Node rawVariableDeclaration()
           
 For rawVariableDeclaration(Node variableDeclaration)
           
 boolean replace(Node replacement)
          Replaces this node with the replacement.
 boolean replaceChild(Node original, Node replacement)
          If the provided child node is a child of this node, the child/parent link will be deleted.
 Node setPosition(Position position)
           
 String toString()
           
 void unparent()
          Severs the child/parent link between this node and its parent.
 Block upToBlock()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface lombok.ast.Node
addMessage, getGeneratedBy, getMessages, getParent, getPosition, hasMessage, hasParent, isGenerated, replace, setPosition, toString, unparent
 

Constructor Detail

For

public For()
Method Detail

upToBlock

public Block upToBlock()
Specified by:
upToBlock in interface Statement

rawExpressionInits

public RawListAccessor<Expression,For> rawExpressionInits()

astExpressionInits

public StrictListAccessor<Expression,For> astExpressionInits()

astVariableDeclaration

public VariableDefinition astVariableDeclaration()

astVariableDeclaration

public For astVariableDeclaration(VariableDefinition variableDeclaration)

rawVariableDeclaration

public Node rawVariableDeclaration()

rawVariableDeclaration

public For rawVariableDeclaration(Node variableDeclaration)

astCondition

public Expression astCondition()

astCondition

public For astCondition(Expression condition)

rawCondition

public Node rawCondition()

rawCondition

public For rawCondition(Node condition)

rawUpdates

public RawListAccessor<Expression,For> rawUpdates()

astUpdates

public StrictListAccessor<Expression,For> astUpdates()

astStatement

public Statement astStatement()

astStatement

public For astStatement(Statement statement)

rawStatement

public Node rawStatement()

rawStatement

public For rawStatement(Node statement)

getChildren

public List<Node> getChildren()
Specified by:
getChildren in interface Node

replaceChild

public boolean replaceChild(Node original,
                            Node replacement)
                     throws AstException
Description copied from interface: Node
If the provided child node is a child of this node, the child/parent link will be deleted. The replacement node, if it is non-null, will take its place, and a new child/parent link will be created between this node and the replacement.

Specified by:
replaceChild in interface Node
Returns:
true if child was indeed a direct child of this node (it will have been replaced).
Throws:
AstException - If the replacement is of the wrong type and the location for the replacement does not allow off-type assignments, which is true for those nodes that only have an astName() method and not a rawName() method.

detach

public boolean detach(Node child)
Description copied from interface: Node
If the provided child node is a child of this node, the child/parent link will be deleted. The child's parentage is set to unparented, and whichever property in this node is linking to the child is cleared. If child is not a child of this node, nothing happens.

Specified by:
detach in interface Node
Returns:
true if child was indeed a direct child of this node (it will have been detached).
See Also:
Node.unparent()

accept

public void accept(AstVisitor visitor)
Specified by:
accept in interface Node

copy

public For copy()
Specified by:
copy in interface Node

isVariableDeclarationBased

public boolean isVariableDeclarationBased()

isStatementExpressionsBased

public boolean isStatementExpressionsBased()

isGenerated

public boolean isGenerated()
Description copied from interface: Node
Returns true if this node is generated (not actually present in the source).

Specified by:
isGenerated in interface Node

getGeneratedBy

public Node getGeneratedBy()
Description copied from interface: Node
Returns the node that is responsible for generating this node. Returns null if this node is not generated.

Specified by:
getGeneratedBy in interface Node

hasParent

public boolean hasParent()
Specified by:
hasParent in interface Node

replace

public boolean replace(Node replacement)
                throws AstException
Description copied from interface: Node
Replaces this node with the replacement.

Specified by:
replace in interface Node
Returns:
true if the node was indeed replaced. Replacement fails if this node has no parent.
Throws:
AstException - If the replacement is of the wrong type and the location for the replacement does not allow off-type assignments, which is true for those nodes that only have an astName() method and not a rawName() method.

unparent

public void unparent()
Description copied from interface: Node
Severs the child/parent link between this node and its parent. This node's parentage will be set to unparented, and whichever property in the parent node is linking to this node is cleared. If this node is already unparented nothing happens.

Specified by:
unparent in interface Node
See Also:
Node.detach(Node)

adopt

protected lombok.ast.AbstractNode adopt(lombok.ast.AbstractNode child)
                                 throws IllegalStateException
Adopts (accepts as direct child) the provided node.

Parameters:
child - The node to adopt
Returns:
The child parameter for chaining.
Throws:
IllegalStateException - If child already has a parent (clone or unparent it first).

ensureParentless

protected void ensureParentless()
                         throws IllegalStateException
Checks if this node is currently parentless.

Throws:
IllegalStateException - if I have a parent.

disown

protected void disown(lombok.ast.AbstractNode child)
               throws IllegalStateException
Disowns a direct child (it will be parentless after this call).

Parameters:
child - Child node to disown
Throws:
IllegalStateException - if child isn't a direct child of myself.

ensureParentage

protected void ensureParentage(lombok.ast.AbstractNode child)
                        throws IllegalStateException
Checks if the provided node is a direct child of this node.

Parameters:
child - This node must be a direct child of myself.
Throws:
IllegalStateException - If child isn't a direct child of myself.

setPosition

public Node setPosition(Position position)
Specified by:
setPosition in interface Node

toString

public String toString()
Specified by:
toString in interface Node
Overrides:
toString in class Object

addMessage

public Node addMessage(Message message)
Specified by:
addMessage in interface Node

hasMessage

public boolean hasMessage(String key)
Specified by:
hasMessage in interface Node

getMessages

public List<Message> getMessages()
Specified by:
getMessages in interface Node

Lombok.ast - v0.2

Copyright © 2010-2011 The Project Lombok Authors, licensed under the MIT licence.