Package org.codehaus.groovy.ast
Class AnnotationNode
java.lang.Object
org.codehaus.groovy.ast.ASTNode
org.codehaus.groovy.ast.AnnotationNode
Represents an annotation which can be attached to interfaces, classes, methods and fields.
- Author:
- James Strachan, Alex Popescu
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addMember
(String name, Expression value) boolean
Flag corresponding toRetentionPolicy.CLASS
.boolean
Flag corresponding toRetentionPolicy
.boolean
Flag corresponding toRetentionPolicy.SOURCE
.boolean
boolean
isTargetAllowed
(int target) void
setAllowedTargets
(int bitmap) void
setClassRetention
(boolean flag) Sets the internal flag if the current annotation hasRetentionPolicy.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 hasRetentionPolicy.SOURCE
.static String
targetToName
(int target) Methods inherited from class org.codehaus.groovy.ast.ASTNode
copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getNodeMetaData, getNodeMetaData, getText, putNodeMetaData, removeNodeMetaData, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setNodeMetaData, setSourcePosition, visit
-
Field Details
-
TYPE_TARGET
public static final int TYPE_TARGET- See Also:
-
CONSTRUCTOR_TARGET
public static final int CONSTRUCTOR_TARGET- See Also:
-
METHOD_TARGET
public static final int METHOD_TARGET- See Also:
-
FIELD_TARGET
public static final int FIELD_TARGET- See Also:
-
PARAMETER_TARGET
public static final int PARAMETER_TARGET- See Also:
-
LOCAL_VARIABLE_TARGET
public static final int LOCAL_VARIABLE_TARGET- See Also:
-
ANNOTATION_TARGET
public static final int ANNOTATION_TARGET- See Also:
-
PACKAGE_TARGET
public static final int PACKAGE_TARGET- See Also:
-
-
Constructor Details
-
AnnotationNode
-
-
Method Details
-
getClassNode
-
getMembers
-
getMember
-
addMember
-
setMember
-
isBuiltIn
public boolean isBuiltIn() -
hasRuntimeRetention
public boolean hasRuntimeRetention()Flag corresponding toRetentionPolicy
.- 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 hasRetentionPolicy.RUNTIME
or if false if theRetentionPolicy.CLASS
.- Parameters:
flag
- if true then current annotation is marked as havingRetentionPolicy.RUNTIME
. If false then the annotation hasRetentionPolicy.CLASS
.
-
hasSourceRetention
public boolean hasSourceRetention()Flag corresponding toRetentionPolicy.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 hasRetentionPolicy.SOURCE
. -
hasClassRetention
public boolean hasClassRetention()Flag corresponding toRetentionPolicy.CLASS
.- Returns:
- true if the annotation is recorded by the compiler, but not visible at runtime * false otherwise
-
setClassRetention
public void setClassRetention(boolean flag) Sets the internal flag if the current annotation hasRetentionPolicy.CLASS
. -
setAllowedTargets
public void setAllowedTargets(int bitmap) -
isTargetAllowed
public boolean isTargetAllowed(int target) -
targetToName
-