Lombok.ast - v0.2

lombok.ast
Class Super

java.lang.Object
  extended by lombok.ast.Super
All Implemented Interfaces:
AnnotationValue, Expression, Node

public class Super
extends Object
implements Expression


Constructor Summary
Super()
           
 
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.
 List<Position> astParensPositions()
          Returns the start/end position of each paren pair around this node.
 TypeReference astQualifier()
           
 Super astQualifier(TypeReference qualifier)
           
 Super 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.
 int getIntendedParens()
          Returns the same value as Expression.getParens(), unless that method returns 0, and Expression.needsParentheses() is true, then this method returns 1.
 List<Message> getMessages()
           
 int getParens()
          Returns the actual amount of parentheses physically around this expression.
 boolean hasMessage(String key)
           
 boolean hasParent()
           
 boolean isGenerated()
          Returns true if this node is generated (not actually present in the source).
 boolean isStatementExpression()
          Returns true if the given expression is a valid statement expression.
 boolean needsParentheses()
          Returns true if the expression would need parentheses because without them the interpretation of this node would be different, due to operator precedence rules.
 Node rawQualifier()
           
 Super rawQualifier(Node qualifier)
           
 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.
 
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

Super

public Super()
Method Detail

astParensPositions

public List<Position> astParensPositions()
Description copied from interface: Expression
Returns the start/end position of each paren pair around this node. The only canonical aspect of this list is the size of it. The positions are set to appropriate files after parsing, from the innermost parens at index 0 to the outermost at the final index.

Specified by:
astParensPositions in interface Expression
See Also:
Expression.getParens()

astQualifier

public TypeReference astQualifier()

astQualifier

public Super astQualifier(TypeReference qualifier)

rawQualifier

public Node rawQualifier()

rawQualifier

public Super rawQualifier(Node qualifier)

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 Super copy()
Specified by:
copy in interface Node

getParens

public int getParens()
Description copied from interface: Expression
Returns the actual amount of parentheses physically around this expression.

Specified by:
getParens in interface Expression
See Also:
Expression.astParensPositions(), Expression.getIntendedParens()

getIntendedParens

public int getIntendedParens()
Description copied from interface: Expression
Returns the same value as Expression.getParens(), unless that method returns 0, and Expression.needsParentheses() is true, then this method returns 1.

Specified by:
getIntendedParens in interface Expression

needsParentheses

public boolean needsParentheses()
Description copied from interface: Expression
Returns true if the expression would need parentheses because without them the interpretation of this node would be different, due to operator precedence rules.

Specified by:
needsParentheses in interface Expression
See Also:
Expression.getIntendedParens()

isStatementExpression

public boolean isStatementExpression()
Description copied from interface: Expression
Returns true if the given expression is a valid statement expression. Statement expressions can be executed as statements simply by appending a semicolon to them.

Specified by:
isStatementExpression in interface Expression

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.