Overview | Package | Class
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.ast
Class AnnotationNode

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

author:
  James Strachan

author:
  Alex Popescu

version:
  $Revision: 7922 $

Field Summary
`int` | `ALL_TARGETS`
`int` | `ANNOTATION_TARGET`
`int` | `CONSTRUCTOR_TARGET`
`int` | `FIELD_TARGET`
`int` | `LOCAL_VARIABLE_TARGET`
`int` | `METHOD_TARGET`
`int` | `PARAMETER_TARGET`
`int` | `TYPE_TARGET`
`int` | `allowedTargets`
`ClassNode` | `classNode`
`Map` | `members`
`boolean` | `runtimeRetention`
`boolean` | `sourceRetention`
`boolean` | `valid`

Constructor Summary
`AnnotationNode(ClassNode classNode)`

Method Summary
`void` | `addMember(String name, Expression value)`
`ClassNode` | `getClassNode()`
`Expression` | `getMember(String name)`
`Map` | `getMembers()`
`boolean` | `hasRuntimeRetention()` Flag corresponding to `RetentionPolicy`.
`boolean` | `hasSourceRetention()` Flag corresponding to `RetentionPolicy.SOURCE`.
`boolean` | `isBuiltIn()`
`boolean` | `isTargetAllowed(int target)`
`boolean` | `isValid()` Returns the state of this annotation (verified and all verification passed).
`void` | `setAllowedTargets(int bitmap)`
`void` | `setMember(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`.
`void` | `setValid(boolean flag)` Set if the current annotation is verified and passed all validations
`static String` | `targetToName(int target)`

Constructor Detail

### AnnotationNode

    public AnnotationNode(ClassNode classNode)

Method Detail

### addMember

    public void addMember(String name, Expression value)

### getClassNode

    public ClassNode getClassNode()

### getMember

    public Expression getMember(String name)

### getMembers

    public Map getMembers()

### hasRuntimeRetention

    public boolean hasRuntimeRetention()

  Flag corresponding to `RetentionPolicy`.
  return:
    `true` if the annotation should be visible at runtime,
  `false` otherwise

### hasSourceRetention

    public boolean hasSourceRetention()

  Flag corresponding to `RetentionPolicy.SOURCE`.
  return:
    `true` if the annotation is only allowed in sources
  `false` otherwise

### isBuiltIn

    public boolean isBuiltIn()

### isTargetAllowed

    public boolean isTargetAllowed(int target)

### isValid

    public boolean isValid()

  Returns the state of this annotation (verified and all verification passed).

### setAllowedTargets

    public void setAllowedTargets(int bitmap)

### setMember

    public void setMember(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`.
  param:
    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`.

### setValid

    public void setValid(boolean flag)

  Set if the current annotation is verified and passed all validations
  param:
    flag

### targetToName

    public static String targetToName(int target)