Groovy Documentation

## org.codehaus.groovy.ast
[Java] Class AnnotationNode

    java.lang.Object
      org.codehaus.groovy.ast.ASTNode
          org.codehaus.groovy.ast.AnnotationNode

    public class AnnotationNode
    extends ASTNode

Represents an annotation which can be attached to interfaces, classes, methods and fields.

Authors:
  James Strachan
  Alex Popescu

Version:
  \$Revision\$

Field Summary
`static int` | `ANNOTATION_TARGET`
`static int` | `CONSTRUCTOR_TARGET`
`static int` | `FIELD_TARGET`
`static int` | `LOCAL_VARIABLE_TARGET`
`static int` | `METHOD_TARGET`
`static int` | `PACKAGE_TARGET`
`static int` | `PARAMETER_TARGET`
`static int` | `TYPE_TARGET`

Constructor Summary
`AnnotationNode(ClassNode classNode)`

Method Summary
`void` | `addMember(java.lang.String name, Expression value)`
`ClassNode` | `getClassNode()`
`Expression` | `getMember(java.lang.String name)`
`java.util.Map` | `getMembers()`
`boolean` | `hasClassRetention()` Flag corresponding to `RetentionPolicy.CLASS`.
`boolean` | `hasRuntimeRetention()` Flag corresponding to `RetentionPolicy`.
`boolean` | `hasSourceRetention()` Flag corresponding to `RetentionPolicy.SOURCE`.
`boolean` | `isBuiltIn()`
`boolean` | `isTargetAllowed(int target)`
`void` | `setAllowedTargets(int bitmap)`
`void` | `setClassRetention(boolean flag)` Sets the internal flag if the current annotation has `RetentionPolicy.CLASS`.
`void` | `setMember(java.lang.String name, Expression value)`
`void` | `setRuntimeRetention(boolean flag)` Sets the internal flag of this annotation runtime retention policy.
`void` | `setSourceRetention(boolean flag)` Sets the internal flag if the current annotation has `RetentionPolicy.SOURCE`.
`static java.lang.String` | `targetToName(int target)`

Methods inherited from class ASTNode
copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getNodeMetaData, getText, putNodeMetaData, removeNodeMetaData, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setNodeMetaData, setSourcePosition, visit

Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Field Detail

### ANNOTATION_TARGET

    public static final int ANNOTATION_TARGET

### CONSTRUCTOR_TARGET

    public static final int CONSTRUCTOR_TARGET

### FIELD_TARGET

    public static final int FIELD_TARGET

### LOCAL_VARIABLE_TARGET

    public static final int LOCAL_VARIABLE_TARGET

### METHOD_TARGET

    public static final int METHOD_TARGET

### PACKAGE_TARGET

    public static final int PACKAGE_TARGET

### PARAMETER_TARGET

    public static final int PARAMETER_TARGET

### TYPE_TARGET

    public static final int TYPE_TARGET

Constructor Detail

### AnnotationNode

    public AnnotationNode(ClassNode classNode)

Method Detail

### addMember

    public void addMember(java.lang.String name, Expression value)

### getClassNode

    public ClassNode getClassNode()

### getMember

    public Expression getMember(java.lang.String name)

### getMembers

    public java.util.Map getMembers()

### hasClassRetention

    public boolean hasClassRetention()

  Flag corresponding to `RetentionPolicy.CLASS`.
  Returns:
    `true` if the annotation is recorded by the compiler, but not visible at runtime * `false` otherwise

### hasRuntimeRetention

    public boolean hasRuntimeRetention()

  Flag corresponding to `RetentionPolicy`.
  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

### isBuiltIn

    public boolean isBuiltIn()

### isTargetAllowed

    public boolean isTargetAllowed(int target)

### setAllowedTargets

    public void setAllowedTargets(int bitmap)

### setClassRetention

    public void setClassRetention(boolean flag)

  Sets the internal flag if the current annotation has `RetentionPolicy.CLASS`.

### setMember

    public void setMember(java.lang.String name, Expression value)

### setRuntimeRetention

    public void setRuntimeRetention(boolean flag)

  Sets the internal flag of this annotation runtime retention policy. If the current annotation has `RetentionPolicy.RUNTIME` or if `false` if the `RetentionPolicy.CLASS`.
  Parameters:
    `flag` - if `true` then current annotation is marked as having `RetentionPolicy.RUNTIME`. If `false` then the annotation has `RetentionPolicy.CLASS`.

### setSourceRetention

    public void setSourceRetention(boolean flag)

  Sets the internal flag if the current annotation has `RetentionPolicy.SOURCE`.

### targetToName

    public static java.lang.String targetToName(int target)

Groovy Documentation