Package org.fife.rsta.ac.java.rjc.ast
Class AbstractTypeDeclarationNode
java.lang.Object
org.fife.rsta.ac.java.rjc.ast.AbstractASTNode
org.fife.rsta.ac.java.rjc.ast.AbstractTypeDeclarationNode
- All Implemented Interfaces:
ASTNode,TypeDeclaration,TypeDeclarationContainer
- Direct Known Subclasses:
EnumDeclaration,NormalClassDeclaration,NormalInterfaceDeclaration
public abstract class AbstractTypeDeclarationNode
extends AbstractASTNode
implements TypeDeclaration
A base class for type declaration nodes.
- Version:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Offsetprivate Offsetprivate List<TypeDeclaration> private booleanprivate Stringprivate Modifiersprivate TypeDeclarationprivate Package -
Constructor Summary
ConstructorsConstructorDescriptionAbstractTypeDeclarationNode(String name, Offset start) AbstractTypeDeclarationNode(String name, Offset start, Offset end) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a member to this type declaration.voidAdds a type declaration to this container.booleangetBodyContainsOffset(int offs) Returns whether this type declaration contains the specified offset.intReturns the end-offset of the type declaration's body.intReturns the start-offset of the type declaration's body.getChildType(int index) Returns a child type by index.getChildTypeAtOffset(int offs) Returns the child type declaration of this one that contains the specified offset, if any.intReturns the number of child types.Returns the doc comment for this type declaration.Returns an iterator over all fields defined in this type.getMember(int index) Returns a member by index.intReturns the number of members in this type declaration.Returns an iterator over all members of this type.Returns an iterator over all methods defined in this type.getMethodsByName(String name) Returns all methods declared in this type with the given name.Returns the modifiers of this type declaration.getName(boolean fullyQualified) Returns the name of this type.Returns the package this type is in.Returns the parent type declaration.private voidinit()booleanReturns whether this type declaration is deprecated.booleanisStatic()Shortcut forgetModifiers().isStatic(); useful sincegetModifiers()may returnnull.voidsetBodyEndOffset(Offset end) voidsetBodyStartOffset(Offset start) voidsetDeprecated(boolean deprecated) voidsetDocComment(String comment) Sets the doc comment for this type declaration.voidsetModifiers(Modifiers modifiers) voidsetPackage(Package pkg) Sets the package this type is in.voidsetParentType(TypeDeclaration parentType) Sets the parent type declaration for this type declaration.toString()Returns the name of this node (e.g.Methods inherited from class org.fife.rsta.ac.java.rjc.ast.AbstractASTNode
getName, getNameEndOffset, getNameStartOffset, setDeclarationEndOffset, setDeclarationOffsetsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.fife.rsta.ac.java.rjc.ast.ASTNode
getNameEndOffset, getNameStartOffsetMethods inherited from interface org.fife.rsta.ac.java.rjc.ast.TypeDeclaration
getName, getTypeString
-
Field Details
-
pkg
-
modifiers
-
parentType
-
childTypes
-
bodyStartOffs
-
bodyEndOffs
-
deprecated
private boolean deprecated -
docComment
-
memberList
-
-
Constructor Details
-
AbstractTypeDeclarationNode
-
AbstractTypeDeclarationNode
-
-
Method Details
-
addMember
Adds a member to this type declaration.- Parameters:
member- The member to add.
-
addTypeDeclaration
Description copied from interface:TypeDeclarationContainerAdds a type declaration to this container.- Specified by:
addTypeDeclarationin interfaceTypeDeclarationContainer- Parameters:
type- The new type declaration.
-
getBodyContainsOffset
public boolean getBodyContainsOffset(int offs) Description copied from interface:TypeDeclarationReturns whether this type declaration contains the specified offset.- Specified by:
getBodyContainsOffsetin interfaceTypeDeclaration- Parameters:
offs- The offset to check.- Returns:
- Whether the offset is contained.
-
getBodyEndOffset
public int getBodyEndOffset()Description copied from interface:TypeDeclarationReturns the end-offset of the type declaration's body.- Specified by:
getBodyEndOffsetin interfaceTypeDeclaration- Returns:
- The end offset.
- See Also:
-
getBodyStartOffset
public int getBodyStartOffset()Description copied from interface:TypeDeclarationReturns the start-offset of the type declaration's body.- Specified by:
getBodyStartOffsetin interfaceTypeDeclaration- Returns:
- The start offset.
- See Also:
-
getChildType
Description copied from interface:TypeDeclarationReturns a child type by index.- Specified by:
getChildTypein interfaceTypeDeclaration- Parameters:
index- The index.- Returns:
- The child type.
- See Also:
-
getChildTypeAtOffset
Description copied from interface:TypeDeclarationReturns the child type declaration of this one that contains the specified offset, if any.- Specified by:
getChildTypeAtOffsetin interfaceTypeDeclaration- Parameters:
offs- The offset.- Returns:
- The type declaration, or
nullif the offset is outside any child type declaration.
-
getChildTypeCount
public int getChildTypeCount()Description copied from interface:TypeDeclarationReturns the number of child types.- Specified by:
getChildTypeCountin interfaceTypeDeclaration- Returns:
- The number of child types.
- See Also:
-
getDocComment
Description copied from interface:TypeDeclarationReturns the doc comment for this type declaration.- Specified by:
getDocCommentin interfaceTypeDeclaration- Returns:
- The doc comment.
- See Also:
-
getFieldIterator
Description copied from interface:TypeDeclarationReturns an iterator over all fields defined in this type.- Specified by:
getFieldIteratorin interfaceTypeDeclaration- Returns:
- The iterator.
- See Also:
-
getMember
Description copied from interface:TypeDeclarationReturns a member by index.- Specified by:
getMemberin interfaceTypeDeclaration- Parameters:
index- The index.- Returns:
- The member.
- See Also:
-
getMemberCount
public int getMemberCount()Description copied from interface:TypeDeclarationReturns the number of members in this type declaration.- Specified by:
getMemberCountin interfaceTypeDeclaration- Returns:
- The number of members.
- See Also:
-
getMemberIterator
Description copied from interface:TypeDeclarationReturns an iterator over all members of this type. Note that an exception may be thrown if a method is added to this type while this iterator is being used.- Specified by:
getMemberIteratorin interfaceTypeDeclaration- Returns:
- The iterator.
- See Also:
-
getMethodIterator
Description copied from interface:TypeDeclarationReturns an iterator over all methods defined in this type.- Specified by:
getMethodIteratorin interfaceTypeDeclaration- Returns:
- The iterator.
- See Also:
-
getMethodsByName
Description copied from interface:TypeDeclarationReturns all methods declared in this type with the given name. Does not check for methods with this name in subclasses.- Specified by:
getMethodsByNamein interfaceTypeDeclaration- Parameters:
name- The name to check for.- Returns:
- Any method overloads with that name, or an empty list if none.
-
getModifiers
Description copied from interface:TypeDeclarationReturns the modifiers of this type declaration.- Specified by:
getModifiersin interfaceTypeDeclaration- Returns:
- The modifier list. This may be
nullif no modifiers were specified.
-
getName
Description copied from interface:TypeDeclarationReturns the name of this type.- Specified by:
getNamein interfaceTypeDeclaration- Parameters:
fullyQualified- Whether the name returned should be fully qualified.- Returns:
- The type's name.
- See Also:
-
getPackage
Returns the package this type is in.- Specified by:
getPackagein interfaceTypeDeclaration- Returns:
- The package, or
nullif it's in the default package.
-
getParentType
Returns the parent type declaration.- Specified by:
getParentTypein interfaceTypeDeclaration- Returns:
- The parent type declaration, or
nullif there isn't one. - See Also:
-
init
private void init() -
isDeprecated
public boolean isDeprecated()Description copied from interface:TypeDeclarationReturns whether this type declaration is deprecated.- Specified by:
isDeprecatedin interfaceTypeDeclaration- Returns:
- Whether this type declaration is deprecated.
-
isStatic
public boolean isStatic()Shortcut forgetModifiers().isStatic(); useful sincegetModifiers()may returnnull.- Specified by:
isStaticin interfaceTypeDeclaration- Returns:
- Whether this type declaration is static.
- See Also:
-
setBodyEndOffset
-
setBodyStartOffset
-
setDeprecated
public void setDeprecated(boolean deprecated) -
setDocComment
Description copied from interface:TypeDeclarationSets the doc comment for this type declaration.- Specified by:
setDocCommentin interfaceTypeDeclaration- Parameters:
comment- The new doc comment.- See Also:
-
setModifiers
-
setPackage
Sets the package this type is in.- Parameters:
pkg- The package, ornullif this is in the default package.- See Also:
-
setParentType
Sets the parent type declaration for this type declaration.- Specified by:
setParentTypein interfaceTypeDeclaration- Parameters:
parentType- The parent type declaration.- See Also:
-
toString
Description copied from class:AbstractASTNodeReturns the name of this node (e.g. the value ofAbstractASTNode.getName()). Subclasses can override this method if appropriate.- Overrides:
toStringin classAbstractASTNode- Returns:
- A string representation of this node.
-