Lombok.ast - v0.2

lombok.ast
Interface Node

All Known Subinterfaces:
AnnotationValue, DescribedNode, Expression, JavadocContainer, Literal, Statement, TypeBody, TypeDeclaration, TypeMember
All Known Implementing Classes:
AlternateConstructorInvocation, Annotation, AnnotationDeclaration, AnnotationElement, AnnotationMethodDeclaration, AnnotationValueArray, ArrayAccess, ArrayCreation, ArrayDimension, ArrayInitializer, Assert, BinaryExpression, Block, BooleanLiteral, Break, Case, Cast, Catch, CharLiteral, ClassDeclaration, ClassLiteral, Comment, CompilationUnit, ConstructorDeclaration, ConstructorInvocation, Continue, Default, DoWhile, EmptyDeclaration, EmptyStatement, EnumConstant, EnumDeclaration, EnumTypeBody, ExpressionStatement, FloatingPointLiteral, For, ForEach, Identifier, If, ImportDeclaration, InlineIfExpression, InstanceInitializer, InstanceOf, IntegralLiteral, InterfaceDeclaration, KeywordModifier, LabelledStatement, MethodDeclaration, MethodInvocation, Modifiers, NormalTypeBody, NullLiteral, PackageDeclaration, Return, Select, StaticInitializer, StringLiteral, Super, SuperConstructorInvocation, Switch, Synchronized, This, Throw, Try, TypeReference, TypeReferencePart, TypeVariable, UnaryExpression, VariableDeclaration, VariableDefinition, VariableDefinitionEntry, VariableReference, While

public interface Node


Method Summary
 void accept(AstVisitor visitor)
           
 Node addMessage(Message message)
           
 Node copy()
           
 boolean detach(Node child)
          If the provided child node is a child of this node, the child/parent link will be deleted.
 List<Node> getChildren()
           
 Node getGeneratedBy()
          Returns the node that is responsible for generating this node.
 List<Message> getMessages()
           
 Node getParent()
           
 Position getPosition()
           
 boolean hasMessage(String key)
           
 boolean hasParent()
           
 boolean isGenerated()
          Returns true if this node is generated (not actually present in the source).
 boolean replace(Node replacement)
          Replaces this node with the replacement.
 boolean replaceChild(Node child, 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.
 

Method Detail

isGenerated

boolean isGenerated()
Returns true if this node is generated (not actually present in the source).


getGeneratedBy

Node getGeneratedBy()
Returns the node that is responsible for generating this node. Returns null if this node is not generated.


hasParent

boolean hasParent()

getChildren

List<Node> getChildren()

replaceChild

boolean replaceChild(Node child,
                     Node replacement)
                     throws AstException
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.

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

boolean detach(Node child)
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.

Returns:
true if child was indeed a direct child of this node (it will have been detached).
See Also:
unparent()

replace

boolean replace(Node replacement)
                throws AstException
Replaces this node with the replacement.

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

void unparent()
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.

See Also:
detach(Node)

setPosition

Node setPosition(Position position)

accept

void accept(AstVisitor visitor)

copy

Node copy()

toString

String toString()
Overrides:
toString in class Object

getParent

Node getParent()

getPosition

Position getPosition()

addMessage

Node addMessage(Message message)

hasMessage

boolean hasMessage(String key)

getMessages

List<Message> getMessages()

Lombok.ast - v0.2

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