Lombok.ast - v0.2

lombok.ast
Class Modifiers

java.lang.Object
  extended by lombok.ast.Modifiers
All Implemented Interfaces:
Node

public class Modifiers
extends Object


Constructor Summary
Modifiers()
           
 
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.
 StrictListAccessor<Annotation,Modifiers> astAnnotations()
           
 StrictListAccessor<KeywordModifier,Modifiers> astKeywords()
           
 Modifiers 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()
           
 int getEffectiveModifierFlags()
          Returns the keyword-based modifiers the way Modifiers works.
 int getExplicitModifierFlags()
          Returns the keyword-based modifiers the way Modifiers works.
 Node getGeneratedBy()
          Returns the node that is responsible for generating this node.
 List<Message> getMessages()
           
 boolean hasMessage(String key)
           
 boolean hasParent()
           
 boolean isAbstract()
           
 boolean isEmpty()
           
 boolean isFinal()
           
 boolean isGenerated()
          Returns true if this node is generated (not actually present in the source).
 boolean isPackagePrivate()
           
 boolean isPrivate()
           
 boolean isProtected()
           
 boolean isPublic()
           
 boolean isStatic()
           
 boolean isTransient()
           
 RawListAccessor<Annotation,Modifiers> rawAnnotations()
           
 RawListAccessor<KeywordModifier,Modifiers> rawKeywords()
           
 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.
 AnnotationDeclaration upToAnnotationDeclaration()
           
 AnnotationMethodDeclaration upToAnnotationMethodDeclaration()
           
 ClassDeclaration upToClassDeclaration()
           
 ConstructorDeclaration upToConstructorDeclaration()
           
 EnumDeclaration upToEnumDeclaration()
           
 InterfaceDeclaration upToInterfaceDeclaration()
           
 MethodDeclaration upToMethodDeclaration()
           
 TypeDeclaration upToTypeDeclaration()
           
 VariableDefinition upToVariableDefinition()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface lombok.ast.Node
getParent, getPosition
 

Constructor Detail

Modifiers

public Modifiers()
Method Detail

upToInterfaceDeclaration

public InterfaceDeclaration upToInterfaceDeclaration()

upToTypeDeclaration

public TypeDeclaration upToTypeDeclaration()

upToAnnotationDeclaration

public AnnotationDeclaration upToAnnotationDeclaration()

upToClassDeclaration

public ClassDeclaration upToClassDeclaration()

upToMethodDeclaration

public MethodDeclaration upToMethodDeclaration()

upToVariableDefinition

public VariableDefinition upToVariableDefinition()

upToEnumDeclaration

public EnumDeclaration upToEnumDeclaration()

upToConstructorDeclaration

public ConstructorDeclaration upToConstructorDeclaration()

upToAnnotationMethodDeclaration

public AnnotationMethodDeclaration upToAnnotationMethodDeclaration()

rawAnnotations

public RawListAccessor<Annotation,Modifiers> rawAnnotations()

astAnnotations

public StrictListAccessor<Annotation,Modifiers> astAnnotations()

rawKeywords

public RawListAccessor<KeywordModifier,Modifiers> rawKeywords()

astKeywords

public StrictListAccessor<KeywordModifier,Modifiers> astKeywords()

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)

copy

public Modifiers copy()

getExplicitModifierFlags

public int getExplicitModifierFlags()
Returns the keyword-based modifiers the way Modifiers works. Only those keywords that are explicitly in the AST are reported; to also include implicit flags, such as for example the idea that methods in interfaces are always public and abstract even if not marked as such, use getEffectiveModifierFlags().


getEffectiveModifierFlags

public int getEffectiveModifierFlags()
Returns the keyword-based modifiers the way Modifiers works. Also sets flags that are implicitly true due to the nature of the node that the modifiers are attached to (for example, inner interfaces are implicitly static and thus if the Modifiers object is a child of such a declaration, its static bit will be set. Similarly, method declarations in interfaces are abstract and public whether or not those keywords have been applied to the node).


isPublic

public boolean isPublic()

isProtected

public boolean isProtected()

isPrivate

public boolean isPrivate()

isPackagePrivate

public boolean isPackagePrivate()

isStatic

public boolean isStatic()

isFinal

public boolean isFinal()

isAbstract

public boolean isAbstract()

isTransient

public boolean isTransient()

isEmpty

public boolean isEmpty()

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.