Interface TypeDeclaration

All Superinterfaces:
ASTNode, TypeDeclarationContainer
All Known Implementing Classes:
AbstractTypeDeclarationNode, EnumDeclaration, NormalClassDeclaration, NormalInterfaceDeclaration

public interface TypeDeclaration extends ASTNode, TypeDeclarationContainer
A type declaration.
Version:
1.0
  • Method Details

    • getBodyContainsOffset

      boolean getBodyContainsOffset(int offs)
      Returns whether this type declaration contains the specified offset.
      Parameters:
      offs - The offset to check.
      Returns:
      Whether the offset is contained.
    • getBodyEndOffset

      int getBodyEndOffset()
      Returns the end-offset of the type declaration's body.
      Returns:
      The end offset.
      See Also:
    • getBodyStartOffset

      int getBodyStartOffset()
      Returns the start-offset of the type declaration's body.
      Returns:
      The start offset.
      See Also:
    • getChildType

      TypeDeclaration getChildType(int index)
      Returns a child type by index.
      Parameters:
      index - The index.
      Returns:
      The child type.
      See Also:
    • getChildTypeAtOffset

      TypeDeclaration getChildTypeAtOffset(int offs)
      Returns the child type declaration of this one that contains the specified offset, if any.
      Parameters:
      offs - The offset.
      Returns:
      The type declaration, or null if the offset is outside any child type declaration.
    • getChildTypeCount

      int getChildTypeCount()
      Returns the number of child types.
      Returns:
      The number of child types.
      See Also:
    • getDocComment

      String getDocComment()
      Returns the doc comment for this type declaration.
      Returns:
      The doc comment.
      See Also:
    • getFieldIterator

      Iterator<Field> getFieldIterator()
      Returns an iterator over all fields defined in this type.
      Returns:
      The iterator.
      See Also:
    • getMember

      Member getMember(int index)
      Returns a member by index.
      Parameters:
      index - The index.
      Returns:
      The member.
      See Also:
    • getMemberCount

      int getMemberCount()
      Returns the number of members in this type declaration.
      Returns:
      The number of members.
      See Also:
    • getMemberIterator

      Iterator<Member> getMemberIterator()
      Returns 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.
      Returns:
      The iterator.
      See Also:
    • getMethodIterator

      Iterator<Method> getMethodIterator()
      Returns an iterator over all methods defined in this type.
      Returns:
      The iterator.
      See Also:
    • getMethodsByName

      List<Method> getMethodsByName(String name)
      Returns all methods declared in this type with the given name. Does not check for methods with this name in subclasses.
      Parameters:
      name - The name to check for.
      Returns:
      Any method overloads with that name, or an empty list if none.
    • getModifiers

      Modifiers getModifiers()
      Returns the modifiers of this type declaration.
      Returns:
      The modifier list. This may be null if no modifiers were specified.
    • getName

      String getName()
      Returns the name of this type, unqualified.
      Specified by:
      getName in interface ASTNode
      Returns:
      The name of this type.
      See Also:
    • getName

      String getName(boolean fullyQualified)
      Returns the name of this type.
      Parameters:
      fullyQualified - Whether the name returned should be fully qualified.
      Returns:
      The type's name.
      See Also:
    • getPackage

      Package getPackage()
      Returns the package this type is in.
      Returns:
      The package, or null if it's in the default package.
    • getParentType

      TypeDeclaration getParentType()
      Returns the parent type declaration.
      Returns:
      The parent type declaration, or null if there isn't one.
      See Also:
    • getTypeString

      String getTypeString()
      Returns the type of this type declaration, as a string.
      Returns:
      The type.
    • isDeprecated

      boolean isDeprecated()
      Returns whether this type declaration is deprecated.
      Returns:
      Whether this type declaration is deprecated.
    • isStatic

      boolean isStatic()
      Shortcut for getModifiers().isStatic(); useful since getModifiers() may return null.
      Returns:
      Whether this type declaration is static.
      See Also:
    • setDocComment

      void setDocComment(String comment)
      Sets the doc comment for this type declaration.
      Parameters:
      comment - The new doc comment.
      See Also:
    • setParentType

      void setParentType(TypeDeclaration parentType)
      Sets the parent type declaration for this type declaration.
      Parameters:
      parentType - The parent type declaration.
      See Also: