Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.jdt.core.dom
Class EnumDeclaration  view EnumDeclaration download EnumDeclaration.java

java.lang.Object
  extended byorg.eclipse.jdt.core.dom.ASTNode
      extended byorg.eclipse.jdt.core.dom.BodyDeclaration
          extended byorg.eclipse.jdt.core.dom.AbstractTypeDeclaration
              extended byorg.eclipse.jdt.core.dom.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 | ; } ]
         }
 

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.

Note: This API element is only needed for dealing with Java code that uses new language features of J2SE 1.5. It is included in anticipation of J2SE 1.5 support, which is planned for the next release of Eclipse after 3.0, and may change slightly before reaching its final form.

Since:
3.0

Nested Class Summary
 
Nested classes inherited from class org.eclipse.jdt.core.dom.ASTNode
ASTNode.NodeList
 
Field Summary
static ChildListPropertyDescriptor BODY_DECLARATIONS_PROPERTY
          The "bodyDeclarations" structural property of this node type.
static ChildPropertyDescriptor JAVADOC_PROPERTY
          The "javadoc" structural property of this node type.
static ChildListPropertyDescriptor MODIFIERS2_PROPERTY
          The "modifiers" structural property of this node type (added in JLS3 API).
static ChildPropertyDescriptor NAME_PROPERTY
          The "name" structural property of this node type.
private static java.util.List PROPERTY_DESCRIPTORS
          A list of property descriptors (element type: StructuralPropertyDescriptor), or null if uninitialized.
static ChildListPropertyDescriptor SUPER_INTERFACE_TYPES_PROPERTY
          The "superInterfaceTypes" structural property of this node type.
private  ASTNode.NodeList superInterfaceTypes
          The superinterface types (element type: Type).
 
Fields inherited from class org.eclipse.jdt.core.dom.AbstractTypeDeclaration
bodyDeclarations, typeName
 
Fields inherited from class org.eclipse.jdt.core.dom.BodyDeclaration
modifiers, optionalDocComment
 
Fields inherited from class org.eclipse.jdt.core.dom.ASTNode
ANNOTATION_TYPE_DECLARATION, ANNOTATION_TYPE_MEMBER_DECLARATION, ANONYMOUS_CLASS_DECLARATION, ARRAY_ACCESS, ARRAY_CREATION, ARRAY_INITIALIZER, ARRAY_TYPE, ASSERT_STATEMENT, ASSIGNMENT, ast, BASE_NODE_SIZE, BLOCK, BLOCK_COMMENT, BOOLEAN_LITERAL, BREAK_STATEMENT, CAST_EXPRESSION, CATCH_CLAUSE, CHARACTER_LITERAL, CLASS_INSTANCE_CREATION, COMPILATION_UNIT, CONDITIONAL_EXPRESSION, CONSTRUCTOR_INVOCATION, CONTINUE_STATEMENT, CYCLE_RISK, DO_STATEMENT, EMPTY_STATEMENT, ENHANCED_FOR_STATEMENT, ENUM_CONSTANT_DECLARATION, ENUM_DECLARATION, EXPRESSION_STATEMENT, FIELD_ACCESS, FIELD_DECLARATION, FOR_STATEMENT, HEADERS, IF_STATEMENT, IMPORT_DECLARATION, INFIX_EXPRESSION, INITIALIZER, INSTANCEOF_EXPRESSION, JAVADOC, LABELED_STATEMENT, LINE_COMMENT, MALFORMED, MANDATORY, MARKER_ANNOTATION, MEMBER_REF, MEMBER_VALUE_PAIR, METHOD_DECLARATION, METHOD_INVOCATION, METHOD_REF, METHOD_REF_PARAMETER, MODIFIER, NO_CYCLE_RISK, NORMAL_ANNOTATION, NULL_LITERAL, NUMBER_LITERAL, OPTIONAL, ORIGINAL, PACKAGE_DECLARATION, PARAMETERIZED_TYPE, PARENTHESIZED_EXPRESSION, POSTFIX_EXPRESSION, PREFIX_EXPRESSION, PRIMITIVE_TYPE, PROTECT, QUALIFIED_NAME, QUALIFIED_TYPE, RETURN_STATEMENT, SIMPLE_NAME, SIMPLE_TYPE, SINGLE_MEMBER_ANNOTATION, SINGLE_VARIABLE_DECLARATION, STRING_LITERAL, SUPER_CONSTRUCTOR_INVOCATION, SUPER_FIELD_ACCESS, SUPER_METHOD_INVOCATION, SWITCH_CASE, SWITCH_STATEMENT, SYNCHRONIZED_STATEMENT, TAG_ELEMENT, TEXT_ELEMENT, THIS_EXPRESSION, THROW_STATEMENT, TRY_STATEMENT, TYPE_DECLARATION, TYPE_DECLARATION_STATEMENT, TYPE_LITERAL, TYPE_PARAMETER, typeAndFlags, VARIABLE_DECLARATION_EXPRESSION, VARIABLE_DECLARATION_FRAGMENT, VARIABLE_DECLARATION_STATEMENT, WHILE_STATEMENT, WILDCARD_TYPE
 
Constructor Summary
(package private) EnumDeclaration(AST ast)
          Creates a new AST node for an enum declaration owned by the given AST.
 
Method Summary
(package private)  void accept0(ASTVisitor visitor)
          Accepts the given visitor on a type-specific visit of the current node.
(package private)  ASTNode clone0(AST target)
          Returns a deep copy of the subtree of AST nodes rooted at this node.
 EnumConstantDeclaration[] getEnumConstants()
          Returns the ordered list of enum constant declarations of this enum declaration.
(package private)  int getNodeType0()
          Returns an integer value identifying the type of this concrete AST node.
(package private)  ChildListPropertyDescriptor internalBodyDeclarationsProperty()
          Returns structural property descriptor for the "bodyDeclarations" property of this node.
(package private)  java.util.List internalGetChildListProperty(ChildListPropertyDescriptor property)
          Returns the list value of the given property for this node.
(package private)  ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property, boolean get, ASTNode child)
          Sets the child value of the given property for this node.
(package private)  ChildPropertyDescriptor internalJavadocProperty()
          Returns structural property descriptor for the "javadoc" property of this node.
(package private)  ChildListPropertyDescriptor internalModifiers2Property()
          Returns structural property descriptor for the "modifiers" property of this node.
(package private)  SimplePropertyDescriptor internalModifiersProperty()
          Returns structural property descriptor for the "modifiers" property of this node.
(package private)  ChildPropertyDescriptor internalNameProperty()
          Returns structural property descriptor for the "name" property of this node.
(package private)  java.util.List internalStructuralPropertiesForType(int apiLevel)
          Returns a list of property descriptors for this node type.
(package private)  int memSize()
          Returns an estimate of the memory footprint of this node in bytes.
static java.util.List propertyDescriptors(int apiLevel)
          Returns a list of structural property descriptors for this node type.
 ITypeBinding resolveBinding()
          Resolves and returns the binding for the enum declared in this enum declaration.
(package private)  boolean subtreeMatch0(ASTMatcher matcher, java.lang.Object other)
          Returns whether the subtree rooted at the given node matches the given other object as decided by the given matcher.
 java.util.List superInterfaceTypes()
          Returns the live ordered list of superinterfaces of this enum declaration.
(package private)  int treeSize()
          Returns an estimate of the memory footprint in bytes of the entire subtree rooted at this node.
 
Methods inherited from class org.eclipse.jdt.core.dom.AbstractTypeDeclaration
bodyDeclarations, getName, internalBodyDeclarationPropertyFactory, internalNamePropertyFactory, isLocalTypeDeclaration, isMemberTypeDeclaration, isPackageMemberTypeDeclaration, setName
 
Methods inherited from class org.eclipse.jdt.core.dom.BodyDeclaration
getJavadoc, getModifiers, internalJavadocPropertyFactory, internalModifiers2PropertyFactory, internalModifiersPropertyFactory, modifiers, setJavadoc, setModifiers
 
Methods inherited from class org.eclipse.jdt.core.dom.ASTNode
accept, acceptChild, acceptChildren, addProperty, appendDebugString, appendPrintString, checkModifiable, checkNewChild, clone, copySubtree, copySubtrees, createPropertyList, delete, equals, getAST, getFlags, getLength, getLocationInParent, getNodeType, getParent, getProperty, getRoot, getStartPosition, getStructuralProperty, internalGetSetBooleanProperty, internalGetSetIntProperty, internalGetSetObjectProperty, nodeClassForType, postLazyInit, postReplaceChild, postValueChange, preLazyInit, preReplaceChild, preValueChange, properties, reapPropertyList, setFlags, setParent, setProperty, setSourceRange, setStructuralProperty, standardToString, stringSize, structuralPropertiesForType, subtreeBytes, subtreeMatch, supportedOnlyIn2, toString, unsupportedIn2
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

JAVADOC_PROPERTY

public static final ChildPropertyDescriptor JAVADOC_PROPERTY
The "javadoc" structural property of this node type.


MODIFIERS2_PROPERTY

public static final ChildListPropertyDescriptor MODIFIERS2_PROPERTY
The "modifiers" structural property of this node type (added in JLS3 API).


NAME_PROPERTY

public static final ChildPropertyDescriptor NAME_PROPERTY
The "name" structural property of this node type.


SUPER_INTERFACE_TYPES_PROPERTY

public static final ChildListPropertyDescriptor SUPER_INTERFACE_TYPES_PROPERTY
The "superInterfaceTypes" structural property of this node type.


BODY_DECLARATIONS_PROPERTY

public static final ChildListPropertyDescriptor BODY_DECLARATIONS_PROPERTY
The "bodyDeclarations" structural property of this node type.


PROPERTY_DESCRIPTORS

private static final java.util.List PROPERTY_DESCRIPTORS
A list of property descriptors (element type: StructuralPropertyDescriptor), or null if uninitialized.


superInterfaceTypes

private ASTNode.NodeList superInterfaceTypes
The superinterface types (element type: Type). Defaults to an empty list.

Constructor Detail

EnumDeclaration

EnumDeclaration(AST ast)
Creates a new AST node for an enum declaration owned by the given AST. By default, the enum declaration has an unspecified, but legal, name; no modifiers; no javadoc; no superinterfaces; and an empty list of body declarations.

N.B. This constructor is package-private; all subclasses must be declared in the same package; clients are unable to declare additional subclasses.

Method Detail

propertyDescriptors

public static java.util.List propertyDescriptors(int apiLevel)
Returns a list of structural property descriptors for this node type. Clients must not modify the result.


internalStructuralPropertiesForType

final java.util.List internalStructuralPropertiesForType(int apiLevel)
Description copied from class: ASTNode
Returns a list of property descriptors for this node type. Clients must not modify the result. This abstract method must be implemented in each concrete AST node type.

N.B. This method is package-private, so that the implementations of this method in each of the concrete AST node types do not clutter up the API doc.

Specified by:
internalStructuralPropertiesForType in class ASTNode

internalGetSetChildProperty

final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property,
                                          boolean get,
                                          ASTNode child)
Description copied from class: ASTNode
Sets the child value of the given property for this node. The default implementation of this method throws an exception explaining that this node does not have such a property. This method should be extended in subclasses that have at leasy one child property.

Overrides:
internalGetSetChildProperty in class ASTNode

internalGetChildListProperty

final java.util.List internalGetChildListProperty(ChildListPropertyDescriptor property)
Description copied from class: ASTNode
Returns the list value of the given property for this node. The default implementation of this method throws an exception explaining that this noed does not have such a property. This method should be extended in subclasses that have at leasy one child list property.

Overrides:
internalGetChildListProperty in class ASTNode

internalJavadocProperty

final ChildPropertyDescriptor internalJavadocProperty()
Description copied from class: BodyDeclaration
Returns structural property descriptor for the "javadoc" property of this node.

Specified by:
internalJavadocProperty in class BodyDeclaration

internalModifiers2Property

final ChildListPropertyDescriptor internalModifiers2Property()
Description copied from class: BodyDeclaration
Returns structural property descriptor for the "modifiers" property of this node.

Specified by:
internalModifiers2Property in class BodyDeclaration

internalModifiersProperty

final SimplePropertyDescriptor internalModifiersProperty()
Description copied from class: BodyDeclaration
Returns structural property descriptor for the "modifiers" property of this node.

Specified by:
internalModifiersProperty in class BodyDeclaration

internalNameProperty

final ChildPropertyDescriptor internalNameProperty()
Description copied from class: AbstractTypeDeclaration
Returns structural property descriptor for the "name" property of this node.

Specified by:
internalNameProperty in class AbstractTypeDeclaration

internalBodyDeclarationsProperty

final ChildListPropertyDescriptor internalBodyDeclarationsProperty()
Description copied from class: AbstractTypeDeclaration
Returns structural property descriptor for the "bodyDeclarations" property of this node.

Specified by:
internalBodyDeclarationsProperty in class AbstractTypeDeclaration

getNodeType0

final int getNodeType0()
Description copied from class: ASTNode
Returns an integer value identifying the type of this concrete AST node.

This internal method is implemented in each of the concrete node subclasses.

Specified by:
getNodeType0 in class ASTNode

clone0

ASTNode clone0(AST target)
Description copied from class: ASTNode
Returns a deep copy of the subtree of AST nodes rooted at this node. The resulting nodes are owned by the given AST, which may be different from the AST of this node. Even if this node has a parent, the result node will be unparented.

This method must be implemented in subclasses.

This method does not report pre- and post-clone events. All callers should instead call clone(AST) to ensure that pre- and post-clone events are reported.

N.B. This method is package-private, so that the implementations of this method in each of the concrete AST node types do not clutter up the API doc.

Specified by:
clone0 in class ASTNode

subtreeMatch0

final boolean subtreeMatch0(ASTMatcher matcher,
                            java.lang.Object other)
Description copied from class: ASTNode
Returns whether the subtree rooted at the given node matches the given other object as decided by the given matcher.

This internal method is implemented in each of the concrete node subclasses.

Specified by:
subtreeMatch0 in class ASTNode

accept0

void accept0(ASTVisitor visitor)
Description copied from class: ASTNode
Accepts the given visitor on a type-specific visit of the current node. This method must be implemented in all concrete AST node types.

General template for implementation on each concrete ASTNode class:

 
 boolean visitChildren = visitor.visit(this);
 if (visitChildren) {
    // visit children in normal left to right reading order
    acceptChild(visitor, getProperty1());
    acceptChildren(visitor, rawListProperty);
    acceptChild(visitor, getProperty2());
 }
 visitor.endVisit(this);
 
 
Note that the caller (accept) take cares of invoking visitor.preVisit(this) and visitor.postVisit(this).

Specified by:
accept0 in class ASTNode

superInterfaceTypes

public java.util.List superInterfaceTypes()
Returns the live ordered list of superinterfaces of this enum declaration.


getEnumConstants

public EnumConstantDeclaration[] getEnumConstants()
Returns the ordered list of enum constant declarations of this enum declaration.

This convenience method returns this node's enum constant declarations with non-enum constants filtered out. Unlike bodyDeclarations, this method does not return a live result.


resolveBinding

public ITypeBinding resolveBinding()
Resolves and returns the binding for the enum declared in this enum declaration.

Note that bindings are generally unavailable unless requested when the AST is being built.


memSize

int memSize()
Description copied from class: ASTNode
Returns an estimate of the memory footprint of this node in bytes. The estimate does not include the space occupied by child nodes.

Overrides:
memSize in class AbstractTypeDeclaration

treeSize

int treeSize()
Description copied from class: ASTNode
Returns an estimate of the memory footprint in bytes of the entire subtree rooted at this node.

N.B. This method is package-private, so that the implementations of this method in each of the concrete AST node types do not clutter up the API doc.

Specified by:
treeSize in class ASTNode