Class Initializer


public class Initializer extends BodyDeclaration
Static or instance initializer AST node type.
 Initializer:
     [ static ] Block
 
Since:
2.0
Restriction:
This class is not intended to be instantiated by clients.
  • Field Details

    • JAVADOC_PROPERTY

      public static final ChildPropertyDescriptor JAVADOC_PROPERTY
      The "javadoc" structural property of this node type (child type: Javadoc).
      Since:
      3.0
    • MODIFIERS_PROPERTY

      public static final SimplePropertyDescriptor MODIFIERS_PROPERTY
      Deprecated.
      In the JLS3 API, this property is replaced by MODIFIERS2_PROPERTY.
      The "modifiers" structural property of this node type (type: Integer) (JLS2 API only).
      Since:
      3.0
    • MODIFIERS2_PROPERTY

      public static final ChildListPropertyDescriptor MODIFIERS2_PROPERTY
      The "modifiers" structural property of this node type (element type: IExtendedModifier) (added in JLS3 API).
      Since:
      3.1
    • BODY_PROPERTY

      public static final ChildPropertyDescriptor BODY_PROPERTY
      The "body" structural property of this node type (child type: Block).
      Since:
      3.0
  • Method Details

    • 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)
      Since:
      3.0
    • getBody

      public Block getBody()
      Returns the body of this initializer declaration.
      Returns:
      the initializer body
    • setBody

      public void setBody(Block body)
      Sets the body of this initializer declaration.
      Parameters:
      body - the block node
      Throws:
      IllegalArgumentException - if:
      • the node belongs to a different AST
      • the node already has a parent
      • a cycle in would be created