Class AnnotationNode

java.lang.Object
org.codehaus.groovy.ast.ASTNode
org.codehaus.groovy.ast.AnnotationNode
All Implemented Interfaces:
NodeMetaDataHandler

public class AnnotationNode extends ASTNode
Represents an annotation which can be attached to interfaces, classes, methods, fields, parameters, and other places.
  • Field Details

  • Constructor Details

    • AnnotationNode

      public AnnotationNode(ClassNode type)
  • Method Details

    • addMember

      public void addMember(String name, Expression value)
    • setMember

      public void setMember(String name, Expression value)
    • setAllowedTargets

      @Deprecated(since="6.0.0") public void setAllowedTargets(int ignored)
      Deprecated.
    • setClassRetention

      @Deprecated(since="6.0.0") public void setClassRetention(boolean ignored)
      Deprecated.
    • setSourceRetention

      @Deprecated(since="6.0.0") public void setSourceRetention(boolean ignored)
      Deprecated.
    • setRuntimeRetention

      @Deprecated(since="6.0.0") public void setRuntimeRetention(boolean ignored)
      Deprecated.
    • getClassNode

      public ClassNode getClassNode()
    • getMembers

      public Map<String,Expression> getMembers()
    • getMember

      public Expression getMember(String name)
    • isBuiltIn

      @Deprecated(since="6.0.0") public boolean isBuiltIn()
      Deprecated.
    • isTargetAllowed

      public boolean isTargetAllowed(int target)
    • hasRuntimeRetention

      public boolean hasRuntimeRetention()
      Flag corresponding to RetentionPolicy.RUNTIME.
      Returns:
      true if the annotation should be visible at runtime; false otherwise
    • hasSourceRetention

      public boolean hasSourceRetention()
      Flag corresponding to RetentionPolicy.SOURCE.
      Returns:
      true if the annotation is only allowed in sources; false otherwise
    • hasClassRetention

      public boolean hasClassRetention()
      Flag corresponding to RetentionPolicy.CLASS. This is the default when no Retention annotation is present.
      Returns:
      true if the annotation is written in the bytecode but not visible at runtime; false otherwise
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getText

      public String getText()
      Overrides:
      getText in class ASTNode
    • targetToName

      public static String targetToName(int target)