Class SingleMemberAnnotation

  • All Implemented Interfaces:
    IExtendedModifier

    public final class SingleMemberAnnotation
    extends Annotation
    Single member annotation node (added in JLS3 API). The single member annotation "@foo(bar)" is equivalent to the normal annotation "@foo(value=bar)".

     SingleMemberAnnotation:
       @ TypeName ( Expression  )
     
    Within annotations, only certain kinds of expressions are meaningful, including other annotations.

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

      • TYPE_NAME_PROPERTY

        public static final ChildPropertyDescriptor TYPE_NAME_PROPERTY
        The "typeName" structural property of this node type (child type: Name).
    • 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)
      • getValue

        public Expression getValue()
        Returns the value of this annotation.
        Returns:
        the value node
      • setValue

        public void setValue​(Expression value)
        Sets the value of this annotation.
        Parameters:
        value - the new value
        Throws:
        IllegalArgumentException - if:
        • the node belongs to a different AST
        • the node already has a parent
        • a cycle in would be created