Top Description Fields Constructors Methods
org.codehaus.groovy.ast

public Class AnnotationNode

extends ASTNode
Class Inheritance
Known Direct Subclasses
org.codehaus.groovy.ast.decompiled.Annotations.DecompiledAnnotationNode
Imports
org.codehaus.groovy.GroovyBugError, org.codehaus.groovy.ast.expr.Expression, java.util.Collections, .LinkedHashMap, .Map

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

Field Summary

Modifier and TypeField and Description
private static final int
private int
public static final int
private final ClassNode
private boolean
public static final int
public static final int
public static final int
private Map<String, Expression>
public static final int
public static final int
public static final int
private boolean
private boolean
public static final int
public static final int
public static final int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
private void
public ClassNode
public Expression
public Map<String, Expression>
public String
public boolean

Returns:

true if the annotation is written in the bytecode, but not visible at runtime false otherwise
hasClassRetention
()

Flag corresponding to RetentionPolicy.CLASS.

public boolean

Returns:

true if the annotation should be visible at runtime, false otherwise
hasRuntimeRetention
()

Flag corresponding to RetentionPolicy.RUNTIME.

public boolean

Returns:

true if the annotation is only allowed in sources false otherwise
hasSourceRetention
()

Flag corresponding to RetentionPolicy.SOURCE.

public boolean
public boolean
isTargetAllowed(int target)

public void
setAllowedTargets(int bitmap)

public void
setClassRetention(boolean
if true then current annotation is marked as having RetentionPolicy.CLASS.
flag
)

Sets the internal flag if the current annotation has an explicit RetentionPolicy.CLASS.

public void
public void
setRuntimeRetention(boolean
if true then current annotation is marked as having RetentionPolicy.RUNTIME.
flag
)

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

public void
setSourceRetention(boolean
if true then current annotation is marked as having RetentionPolicy.SOURCE.
flag
)

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

public static String
targetToName(int target)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from org.codehaus.groovy.ast.ASTNode:
copyNodeMetaDatagetColumnNumbergetLastColumnNumbergetLastLineNumbergetLineNumbergetMetaDataMapsetColumnNumbersetLastColumnNumbersetLastLineNumbersetLineNumbersetMetaDataMapsetSourcePositionvisit

Field Detail

ALL_TARGETSback to summary
private static final int ALL_TARGETS
allowedTargetsback to summary
private int allowedTargets
ANNOTATION_TARGETback to summary
public static final int ANNOTATION_TARGET
classNodeback to summary
private final ClassNode classNode
classRetentionback to summary
private boolean classRetention
CONSTRUCTOR_TARGETback to summary
public static final int CONSTRUCTOR_TARGET
FIELD_TARGETback to summary
public static final int FIELD_TARGET
LOCAL_VARIABLE_TARGETback to summary
public static final int LOCAL_VARIABLE_TARGET
membersback to summary
private Map<String, Expression> members
METHOD_TARGETback to summary
public static final int METHOD_TARGET
PACKAGE_TARGETback to summary
public static final int PACKAGE_TARGET
PARAMETER_TARGETback to summary
public static final int PARAMETER_TARGET
runtimeRetentionback to summary
private boolean runtimeRetention
sourceRetentionback to summary
private boolean sourceRetention
TYPE_PARAMETER_TARGETback to summary
public static final int TYPE_PARAMETER_TARGET
TYPE_TARGETback to summary
public static final int TYPE_TARGET
TYPE_USE_TARGETback to summary
public static final int TYPE_USE_TARGET

Constructor Detail

AnnotationNodeback to summary
public AnnotationNode(ClassNode classNode)

Method Detail

addMemberback to summary
public void addMember(String name, Expression value)
assertMembersback to summary
private void assertMembers()
getClassNodeback to summary
public ClassNode getClassNode()
getMemberback to summary
public Expression getMember(String name)
getMembersback to summary
public Map<String, Expression> getMembers()
getTextback to summary
public String getText()

Overrides org.codehaus.groovy.ast.ASTNode.getText.

Annotations
@Override
hasClassRetentionback to summary
public boolean hasClassRetention()

Flag corresponding to RetentionPolicy.CLASS. This is the default when no RetentionPolicy annotations are present.

Returns:boolean

true if the annotation is written in the bytecode, but not visible at runtime false otherwise

hasRuntimeRetentionback to summary
public boolean hasRuntimeRetention()

Flag corresponding to RetentionPolicy.RUNTIME.

Returns:boolean

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

hasSourceRetentionback to summary
public boolean hasSourceRetention()

Flag corresponding to RetentionPolicy.SOURCE.

Returns:boolean

true if the annotation is only allowed in sources false otherwise

isBuiltInback to summary
public boolean isBuiltIn()
isTargetAllowedback to summary
public boolean isTargetAllowed(int target)
setAllowedTargetsback to summary
public void setAllowedTargets(int bitmap)
setClassRetentionback to summary
public void setClassRetention(boolean flag)

Sets the internal flag if the current annotation has an explicit RetentionPolicy.CLASS.

Parameters
flag:boolean

if true then current annotation is marked as having RetentionPolicy.CLASS.

setMemberback to summary
public void setMember(String name, Expression value)
setRuntimeRetentionback to summary
public void setRuntimeRetention(boolean flag)

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

Parameters
flag:boolean

if true then current annotation is marked as having RetentionPolicy.RUNTIME.

setSourceRetentionback to summary
public void setSourceRetention(boolean flag)

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

Parameters
flag:boolean

if true then current annotation is marked as having RetentionPolicy.SOURCE.

targetToNameback to summary
public static String targetToName(int target)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override