Package org.codehaus.groovy.ast
Class AnnotationNode
java.lang.Object
org.codehaus.groovy.ast.ASTNode
org.codehaus.groovy.ast.AnnotationNode
- All Implemented Interfaces:
NodeMetaDataHandler
Represents an annotation which can be attached to interfaces, classes, methods, fields, parameters, and other places.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intGroovy-only target for annotations on import statements.static final intstatic final intstatic final intstatic final intstatic final intstatic final intGroovy-only target for statement-level annotations (e.g.static final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMember(String name, Expression value) getText()booleanFlag corresponding toRetentionPolicy.CLASS.booleanFlag corresponding toRetentionPolicy.RUNTIME.booleanFlag corresponding toRetentionPolicy.SOURCE.booleanDeprecated.booleanisTargetAllowed(int target) voidsetAllowedTargets(int ignored) Deprecated.voidsetClassRetention(boolean ignored) Deprecated.voidsetMember(String name, Expression value) voidsetRuntimeRetention(boolean ignored) Deprecated.voidsetSourceRetention(boolean ignored) Deprecated.static StringtargetToName(int target) toString()Methods inherited from class org.codehaus.groovy.ast.ASTNode
copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visitMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.codehaus.groovy.ast.NodeMetaDataHandler
copyNodeMetaData, getNodeMetaData, getNodeMetaData, getNodeMetaData, newMetaDataMap, putNodeMetaData, removeNodeMetaData, setNodeMetaData
-
Field Details
-
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:
-
TYPE_PARAMETER_TARGET
public static final int TYPE_PARAMETER_TARGET- See Also:
-
TYPE_USE_TARGET
public static final int TYPE_USE_TARGET- See Also:
-
RECORD_COMPONENT_TARGET
public static final int RECORD_COMPONENT_TARGET- See Also:
-
STATEMENT_TARGET
public static final int STATEMENT_TARGETGroovy-only target for statement-level annotations (e.g. onfor/whileloops).- See Also:
-
IMPORT_TARGET
public static final int IMPORT_TARGETGroovy-only target for annotations on import statements.- See Also:
-
TYPE_TARGET
public static final int TYPE_TARGET- See Also:
-
-
Constructor Details
-
AnnotationNode
-
-
Method Details
-
addMember
-
setMember
-
setAllowedTargets
Deprecated. -
setClassRetention
Deprecated. -
setSourceRetention
Deprecated. -
setRuntimeRetention
Deprecated. -
getClassNode
-
getMembers
-
getMember
-
isBuiltIn
Deprecated. -
isTargetAllowed
public boolean isTargetAllowed(int target) -
hasRuntimeRetention
public boolean hasRuntimeRetention()Flag corresponding toRetentionPolicy.RUNTIME.- Returns:
- true if the annotation should be visible at runtime; false otherwise
-
hasSourceRetention
public boolean hasSourceRetention()Flag corresponding toRetentionPolicy.SOURCE.- Returns:
- true if the annotation is only allowed in sources; false otherwise
-
hasClassRetention
public boolean hasClassRetention()Flag corresponding toRetentionPolicy.CLASS. This is the default when noRetentionannotation is present.- Returns:
- true if the annotation is written in the bytecode but not visible at runtime; false otherwise
-
toString
-
getText
-
targetToName
-