org.eclipse.emf.codegen.merge.java.facade.ast
Class ASTJMember<T extends org.eclipse.jdt.core.dom.BodyDeclaration>

java.lang.Object
  extended by org.eclipse.emf.codegen.merge.java.facade.AbstractJNode
      extended by org.eclipse.emf.codegen.merge.java.facade.ast.ASTJNode<T>
          extended by org.eclipse.emf.codegen.merge.java.facade.ast.ASTJMember<T>
Type Parameters:
T - wrapped body declaration type
All Implemented Interfaces:
JMember, JNode
Direct Known Subclasses:
ASTJAbstractType, ASTJAnnotationTypeMember, ASTJEnumConstant, ASTJField, ASTJInitializer, ASTJMethod

public abstract class ASTJMember<T extends org.eclipse.jdt.core.dom.BodyDeclaration>
extends ASTJNode<T>
implements JMember

Each ASTJMember has a reference to BodyDeclaration as a wrapped object.

Since:
2.2.0

Field Summary
protected  java.lang.String comment
          Cached value of member comment.
 
Fields inherited from class org.eclipse.emf.codegen.merge.java.facade.ast.ASTJNode
isCommentedOut, name, rewriter, UNITIALIZED_STRING
 
Fields inherited from class org.eclipse.emf.codegen.merge.java.facade.AbstractJNode
EMPTY_STRING_ARRAY, qualifiedName
 
Constructor Summary
ASTJMember(T bodyDeclaration)
           
 
Method Summary
 boolean addChild(ASTJNode<?> child)
          Adds a child to this node.
 void dispose()
           
protected  java.util.List<JNode> getAnnotationList()
           
 java.util.List<JNode> getChildren()
          Returns the children of this node.
 java.lang.String getComment()
          Returns the comment associated with this member (including comment delimiters).
 int getFlags()
          Returns original flags of the member.
protected  void insertLastAnnotation(ASTJAnnotation annotation)
          Insert annotation after the last annotation of the given body declaration.
 boolean insertSibling(ASTJNode<?> node, ASTJNode<?> newSibling, boolean before)
          Inserts newSibling as a child of this node before or after the given node.
 boolean remove(ASTJNode<?> node)
          Removes a node.
 void setComment(java.lang.String comment)
          Sets the comment associated with this member.
 void setFlags(int flags)
          Sets the flags of the member.
 
Methods inherited from class org.eclipse.emf.codegen.merge.java.facade.ast.ASTJNode
addValueToListProperty, addValueToListProperty, ancestorInserted, ancestorToBeRemoved, childToBeChanged, combineArrayAndList, commentOut, convertASTNodeListToStringArray, disableTrackAndReplace, enableTrackAndReplace, getASTNode, getContents, getFacadeHelper, getParent, getRemovedASTNode, getRewriter, getWrappedObject, insert, insertFirst, insertLast, isDisposed, nodeToBeMoved, nodeToBeRemoved, remove, removeNodeFromListProperty, removeTrackAndReplace, setASTNode, setFacadeHelper, setListNodeProperty, setNodeProperty, setNodeProperty, setParent, setRemovedASTNode, setRewriter, setTrackedNodeProperty, setWrappedObject, trackAndReplace
 
Methods inherited from class org.eclipse.emf.codegen.merge.java.facade.AbstractJNode
computeQualifiedName, computeQualifiedName, computeQualifiedName, computeQualifiedName, getName, getQualifiedName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.codegen.merge.java.facade.JNode
getContents, getName, getParent, getQualifiedName, setName
 

Field Detail

comment

protected java.lang.String comment
Cached value of member comment.

See Also:
getComment(), setComment(String)
Constructor Detail

ASTJMember

public ASTJMember(T bodyDeclaration)
Parameters:
bodyDeclaration -
Method Detail

dispose

public void dispose()
Overrides:
dispose in class ASTJNode<T extends org.eclipse.jdt.core.dom.BodyDeclaration>

getFlags

public int getFlags()
Returns original flags of the member.

Specified by:
getFlags in interface JNode
Overrides:
getFlags in class AbstractJNode
See Also:
AbstractJNode.getFlags()

setFlags

public void setFlags(int flags)
Sets the flags of the member.

Note that getFlags() will not return the new value.

Specified by:
setFlags in interface JNode
Overrides:
setFlags in class ASTJNode<T extends org.eclipse.jdt.core.dom.BodyDeclaration>
Parameters:
flags - the flags
See Also:
ASTJNode.setFlags(int)

getComment

public java.lang.String getComment()
Description copied from interface: JMember
Returns the comment associated with this member (including comment delimiters).

Specified by:
getComment in interface JMember
Returns:
the comment, or null if this member has no associated comment

setComment

public void setComment(java.lang.String comment)
Description copied from interface: JMember
Sets the comment associated with this member. The comment will appear before the member in the source. The comment must be properly formatted, including delimiters. A null comment indicates no comment.

Specified by:
setComment in interface JMember
Parameters:
comment - the comment, including comment delimiters, or null indicating this member should have no associated comment

remove

public boolean remove(ASTJNode<?> node)
Description copied from class: ASTJNode
Removes a node.

Default implementation does nothing and returns false.

Overrides:
remove in class ASTJNode<T extends org.eclipse.jdt.core.dom.BodyDeclaration>
Parameters:
node - must be a child of this node
Returns:
true if operation successful, false otherwise

insertSibling

public boolean insertSibling(ASTJNode<?> node,
                             ASTJNode<?> newSibling,
                             boolean before)
Description copied from class: ASTJNode
Inserts newSibling as a child of this node before or after the given node.

Default implementation does nothing and returns false.

Overrides:
insertSibling in class ASTJNode<T extends org.eclipse.jdt.core.dom.BodyDeclaration>
newSibling - to insert
before - true if newSibling must be before node, false if after
Returns:
true if operation successful, false otherwise

addChild

public boolean addChild(ASTJNode<?> child)
Description copied from class: ASTJNode
Adds a child to this node.

Default implementation does nothing and returns false.

Overrides:
addChild in class ASTJNode<T extends org.eclipse.jdt.core.dom.BodyDeclaration>
Parameters:
child - to add
Returns:
true if operation successful, false otherwise

getChildren

public java.util.List<JNode> getChildren()
Description copied from interface: JNode
Returns the children of this node. Returns an empty list if this node has no children (including nodes that cannot have children). Children appear in the order in which they are declared in the source code.

The list must be unmodifiable if the implementation doesn't support direct manipulation.

Specified by:
getChildren in interface JNode
Overrides:
getChildren in class AbstractJNode
Returns:
a list of the children

getAnnotationList

protected java.util.List<JNode> getAnnotationList()

insertLastAnnotation

protected void insertLastAnnotation(ASTJAnnotation annotation)
Insert annotation after the last annotation of the given body declaration.

Note that modifiers and annotations can alternate in the modifiers list. This method inserts the new annotation after the last existing annotation.

Parameters:
annotation -

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.