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: 12172 $

Field Summary
 int ALL_TARGETS
           
 int ANNOTATION_TARGET
           
 int CONSTRUCTOR_TARGET
           
 int FIELD_TARGET
           
 int LOCAL_VARIABLE_TARGET
           
 int METHOD_TARGET
           
 int PACKAGE_TARGET
           
 int PARAMETER_TARGET
           
 int TYPE_TARGET
           
 int allowedTargets
           
 ClassNode classNode
           
 boolean classRetention
           
 Map members
           
 boolean runtimeRetention
           
 boolean sourceRetention
           
 
Constructor Summary
AnnotationNode(ClassNode classNode)
           
 
Method Summary
void addMember(String name, Expression value)
          
ClassNode getClassNode()
          
Expression getMember(String name)
          
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(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 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()


hasClassRetention

public boolean hasClassRetention()
Flag corresponding to RetentionPolicy.CLASS.
return:
true if the annotation is recorded by the compiler,
but not visible at runtime * false otherwise


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)


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(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.


targetToName

public static String targetToName(int target)