Class Annotation

All Implemented Interfaces:
IExtendedModifier
Direct Known Subclasses:
MarkerAnnotation, NormalAnnotation, SingleMemberAnnotation

public abstract class Annotation extends Expression implements IExtendedModifier
Abstract base class of AST nodes that represent annotations.
 Annotation:
                NormalAnnotation
                MarkerAnnotation
                SingleMemberAnnotation
 
Since:
3.1
  • Method Details

    • getTypeNameProperty

      public final ChildPropertyDescriptor getTypeNameProperty()
      Returns structural property descriptor for the "typeName" property of this node (child type: Name).
      Returns:
      the property descriptor
    • isModifier

      public boolean isModifier()
      Description copied from interface: IExtendedModifier
      Returns whether this extended modifier is a standard modifier.
      Specified by:
      isModifier in interface IExtendedModifier
      Returns:
      true if this is a standard modifier (instance of Modifier), and false otherwise
      See Also:
    • isAnnotation

      public boolean isAnnotation()
      Description copied from interface: IExtendedModifier
      Returns whether this extended modifier is an annotation.
      Specified by:
      isAnnotation in interface IExtendedModifier
      Returns:
      true if this is an annotation (instance of a subclass of Annotation), and false otherwise
      See Also:
    • getTypeName

      public Name getTypeName()
      Returns the annotation type name of this annotation.
      Returns:
      the annotation type name
    • setTypeName

      public void setTypeName(Name typeName)
      Sets the annotation type name of this annotation.
      Parameters:
      typeName - the annotation type name
      Throws:
      IllegalArgumentException - if:
      • the node belongs to a different AST
      • the node already has a parent
    • isNormalAnnotation

      public boolean isNormalAnnotation()
      Returns whether this is a normal annotation (NormalAnnotation).
      Returns:
      true if this is a normal annotation, and false otherwise
    • isMarkerAnnotation

      public boolean isMarkerAnnotation()
      Returns whether this is a marker annotation (MarkerAnnotation).
      Returns:
      true if this is a marker annotation, and false otherwise
    • isSingleMemberAnnotation

      public boolean isSingleMemberAnnotation()
      Returns whether this is a single member annotation. (SingleMemberAnnotation).
      Returns:
      true if this is a single member annotation, and false otherwise
    • resolveAnnotationBinding

      public IAnnotationBinding resolveAnnotationBinding()
      Resolves and returns the resolved annotation for this annotation.

      Note that bindings (which includes resolved annotations) are generally unavailable unless requested when the AST is being built.

      Returns:
      the resolved annotation, or null if the annotation cannot be resolved
      Since:
      3.2