Class AnnotationTypeMemberDeclaration

java.lang.Object
org.eclipse.jdt.core.dom.ASTNode
org.eclipse.jdt.core.dom.BodyDeclaration
org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration

public class AnnotationTypeMemberDeclaration extends BodyDeclaration
Annotation type member declaration AST node type (added in JLS3 API).
 AnnotationTypeMemberDeclaration:
   [ Javadoc ] { ExtendedModifier }
       Type Identifier ( ) [ default Expression ] ;
 

Note that annotation type member declarations are only meaningful as elements of AbstractTypeDeclaration.bodyDeclarations().

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 keyword (if modifiers), or the first character of the member type (no modifiers). The source range extends through the last character of the ";" token.

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

  • 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)
    • getType

      public Type getType()
      Returns the type of the annotation type member declared in this declaration.
      Returns:
      the type of the member
    • setType

      public void setType(Type type)
      Sets the type of the annotation type member declared in this declaration to the given type.
      Parameters:
      type - the new member type
      Throws:
      IllegalArgumentException - if:
      • the node belongs to a different AST
      • the node already has a parent
    • getName

      public SimpleName getName()
      Returns the name of the annotation type member declared in this declaration.
      Returns:
      the member name node
    • setName

      public void setName(SimpleName memberName)
      Sets the name of the annotation type member declared in this declaration to the given name.
      Parameters:
      memberName - the new member name
      Throws:
      IllegalArgumentException - if:
      • the node belongs to a different AST
      • the node already has a parent
    • getDefault

      public Expression getDefault()
      Returns the default value of this annotation type member, or null if there is none.
      Returns:
      the expression node, or null if there is none
    • setDefault

      public void setDefault(Expression defaultValue)
      Sets or clears the default value of this annotation type member.
      Parameters:
      defaultValue - the expression node, or null if there is none
      Throws:
      IllegalArgumentException - if:
      • the node belongs to a different AST
      • the node already has a parent
      • a cycle in would be created
    • resolveBinding

      public IMethodBinding resolveBinding()
      Resolves and returns the binding for the annotation type member declared in this declaration.

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

      Returns:
      the binding, or null if the binding cannot be resolved