Class EnumDeclaration


  • public class EnumDeclaration
    extends AbstractTypeDeclaration
    Enum declaration AST node type (added in JLS3 API).
     EnumDeclaration:
         [ Javadoc ] { ExtendedModifier } enum Identifier
             [ implements Type { , Type } ]
             {
             [ EnumConstantDeclaration { , EnumConstantDeclaration } ] [ , ]
             [ ; { ClassBodyDeclaration | ; } ]
             }
     
    The enumConstants() list holds the enum constant declarations, while the AbstractTypeDeclaration.bodyDeclarations() list holds the class body declarations that appear after the semicolon.

    When a Javadoc comment is present, the source range begins with the first character of the "/**" comment delimiter. When there is no Javadoc comment, the source range begins with the first character of the first modifier or annotation (if present), or the first character of the "enum" keyword (if no modifiers or annotations). The source range extends through the last character of the "}" token following the body declarations.

    Since:
    3.1
    Restriction:
    This class is not intended to be instantiated by clients.
    • Method Detail

      • propertyDescriptors

        public static List propertyDescriptors​(int apiLevel)
        Returns a list of structural property descriptors for this node type. Clients must not modify the result.
        Parameters:
        apiLevel - the API level; one of the AST.JLS* constants
        Returns:
        a list of property descriptors (element type: StructuralPropertyDescriptor)
      • superInterfaceTypes

        public List superInterfaceTypes()
        Returns the live ordered list of superinterfaces of this enum declaration.
        Returns:
        the live list of super interface types (element type: Type)
      • enumConstants

        public List enumConstants()
        Returns the live ordered list of enum constant declarations of this enum declaration.
        Returns:
        the live list of enum constant declarations (element type: EnumConstantDeclaration)