## org.codehaus.groovy.ast
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.

Version:
  $Revision: 7922 $
Author:
  James Strachan, Alex Popescu

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` `PARAMETER_TARGET`
`static int` `TYPE_TARGET`

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)`

Methods inherited from class org.codehaus.groovy.ast.ASTNode
`getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setSourcePosition, visit`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### TYPE_TARGET

    public static final int TYPE_TARGET

See Also:
  Constant Field Values

### CONSTRUCTOR_TARGET

    public static final int CONSTRUCTOR_TARGET

See Also:
  Constant Field Values

### METHOD_TARGET

    public static final int METHOD_TARGET

See Also:
  Constant Field Values

### FIELD_TARGET

    public static final int FIELD_TARGET

See Also:
  Constant Field Values

### PARAMETER_TARGET

    public static final int PARAMETER_TARGET

See Also:
  Constant Field Values

### LOCAL_VARIABLE_TARGET

    public static final int LOCAL_VARIABLE_TARGET

See Also:
  Constant Field Values

### ANNOTATION_TARGET

    public static final int ANNOTATION_TARGET

See Also:
  Constant Field Values

Constructor Detail

### AnnotationNode

    public AnnotationNode(ClassNode classNode)

Method Detail

### getClassNode

    public ClassNode getClassNode()

### getMembers

    public Map getMembers()

### getMember

    public Expression getMember(String name)

### addMember

    public void addMember(String name,
                          Expression value)

### setMember

    public void setMember(String name,
                          Expression value)

### isBuiltIn

    public boolean isBuiltIn()

### hasRuntimeRetention

    public boolean hasRuntimeRetention()

  Flag corresponding to `RetentionPolicy`.

  Returns:
    `true` if the annotation should be visible at runtime, `false` otherwise

### 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`.

### hasSourceRetention

    public boolean hasSourceRetention()

  Flag corresponding to `RetentionPolicy.SOURCE`.

  Returns:
    `true` if the annotation is only allowed in sources `false` otherwise

### setSourceRetention

    public void setSourceRetention(boolean flag)

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

### setAllowedTargets

    public void setAllowedTargets(int bitmap)

### isTargetAllowed

    public boolean isTargetAllowed(int target)

### setValid

    public void setValid(boolean flag)

  Set if the current annotation is verified and passed all validations

  Parameters:
    `flag` -

### isValid

    public boolean isValid()

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

### targetToName

    public static final String targetToName(int target)

Copyright © 2003-2008 The Codehaus. All rights reserved.