Interface TypeDecl

  • All Superinterfaces:
    ASTNode
    All Known Implementing Classes:
    ClassDecl, EnumDecl, InterfaceDecl

    public interface TypeDecl
    extends ASTNode
    A declared type in the source AST - class, interface, enum or annotation - exposing its modifiers, annotations and members.
    • Method Detail

      • getName

        String getName()
        Returns:
        the simple type name
      • getModifiers

        Set<Modifier> getModifiers()
        Returns:
        the declared modifiers
      • getInnerTypes

        NodeList<TypeDecl> getInnerTypes()
        Returns:
        the types declared inside this one
      • isPublic

        default boolean isPublic()
        Returns:
        true when the type is declared public
      • isProtected

        default boolean isProtected()
        Returns:
        true when the type is declared protected
      • isPrivate

        default boolean isPrivate()
        Returns:
        true when the type is declared private
      • isStatic

        default boolean isStatic()
        Returns:
        true when the type is declared static
      • isFinal

        default boolean isFinal()
        Returns:
        true when the type is declared final
      • isAbstract

        default boolean isAbstract()
        Returns:
        true when the type is declared abstract
      • getMethod

        default MethodDecl getMethod​(String name)
        Finds a declared method by name, ignoring the descriptor.
        Parameters:
        name - the method name to match
        Returns:
        the first method with that name, or null when none has it
      • getField

        default FieldDecl getField​(String name)
        Finds a declared field by name.
        Parameters:
        name - the field name to match
        Returns:
        the matching field, or null when there is none
      • getInnerType

        default TypeDecl getInnerType​(String name)
        Finds a directly nested type by simple name.
        Parameters:
        name - the inner type name to match
        Returns:
        the matching inner type, or null when there is none