Package org.codehaus.groovy.ast
Class AnnotationNode
- java.lang.Object
- 
- org.codehaus.groovy.ast.ASTNode
- 
- org.codehaus.groovy.ast.AnnotationNode
 
 
- 
- All Implemented Interfaces:
- NodeMetaDataHandler
 
 public class AnnotationNode extends ASTNode Represents an annotation which can be attached to interfaces, classes, methods, fields, parameters, and other places.
- 
- 
Field SummaryFields Modifier and Type Field Description static intANNOTATION_TARGETstatic intCONSTRUCTOR_TARGETstatic intFIELD_TARGETstatic intLOCAL_VARIABLE_TARGETstatic intMETHOD_TARGETstatic intPACKAGE_TARGETstatic intPARAMETER_TARGETstatic intTYPE_PARAMETER_TARGETstatic intTYPE_TARGETstatic intTYPE_USE_TARGET
 - 
Constructor SummaryConstructors Constructor Description AnnotationNode(ClassNode classNode)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMember(String name, Expression value)ClassNodegetClassNode()ExpressiongetMember(String name)Map<String,Expression>getMembers()StringgetText()booleanhasClassRetention()Flag corresponding toRetentionPolicy.CLASS.booleanhasRuntimeRetention()Flag corresponding toRetentionPolicy.RUNTIME.booleanhasSourceRetention()Flag corresponding toRetentionPolicy.SOURCE.booleanisBuiltIn()booleanisTargetAllowed(int target)voidsetAllowedTargets(int bitmap)voidsetClassRetention(boolean flag)Sets the internal flag if the current annotation has an explicitRetentionPolicy.CLASS.voidsetMember(String name, Expression value)voidsetRuntimeRetention(boolean flag)Sets the internal flag if the current annotation hasRetentionPolicy.SOURCE.voidsetSourceRetention(boolean flag)Sets the internal flag if the current annotation hasRetentionPolicy.SOURCE.static StringtargetToName(int target)StringtoString()- 
Methods inherited from class org.codehaus.groovy.ast.ASTNodecopyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visit
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface org.codehaus.groovy.ast.NodeMetaDataHandlercopyNodeMetaData, getNodeMetaData, getNodeMetaData, getNodeMetaData, putNodeMetaData, removeNodeMetaData, setNodeMetaData
 
- 
 
- 
- 
- 
Field Detail- 
CONSTRUCTOR_TARGETpublic static final int CONSTRUCTOR_TARGET - See Also:
- Constant Field Values
 
 - 
METHOD_TARGETpublic static final int METHOD_TARGET - See Also:
- Constant Field Values
 
 - 
FIELD_TARGETpublic static final int FIELD_TARGET - See Also:
- Constant Field Values
 
 - 
PARAMETER_TARGETpublic static final int PARAMETER_TARGET - See Also:
- Constant Field Values
 
 - 
LOCAL_VARIABLE_TARGETpublic static final int LOCAL_VARIABLE_TARGET - See Also:
- Constant Field Values
 
 - 
ANNOTATION_TARGETpublic static final int ANNOTATION_TARGET - See Also:
- Constant Field Values
 
 - 
PACKAGE_TARGETpublic static final int PACKAGE_TARGET - See Also:
- Constant Field Values
 
 - 
TYPE_PARAMETER_TARGETpublic static final int TYPE_PARAMETER_TARGET - See Also:
- Constant Field Values
 
 - 
TYPE_USE_TARGETpublic static final int TYPE_USE_TARGET - See Also:
- Constant Field Values
 
 - 
TYPE_TARGETpublic static final int TYPE_TARGET - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
AnnotationNodepublic AnnotationNode(ClassNode classNode) 
 
- 
 - 
Method Detail- 
getClassNodepublic ClassNode getClassNode() 
 - 
getMemberspublic Map<String,Expression> getMembers() 
 - 
getMemberpublic Expression getMember(String name) 
 - 
addMemberpublic void addMember(String name, Expression value) 
 - 
setMemberpublic void setMember(String name, Expression value) 
 - 
isBuiltInpublic boolean isBuiltIn() 
 - 
hasRuntimeRetentionpublic boolean hasRuntimeRetention() Flag corresponding toRetentionPolicy.RUNTIME.- Returns:
- true if the annotation should be visible at runtime, false otherwise
 
 - 
setRuntimeRetentionpublic void setRuntimeRetention(boolean flag) Sets the internal flag if the current annotation hasRetentionPolicy.SOURCE.- Parameters:
- flag- if true then current annotation is marked as having- RetentionPolicy.RUNTIME.
 
 - 
hasSourceRetentionpublic boolean hasSourceRetention() Flag corresponding toRetentionPolicy.SOURCE.- Returns:
- true if the annotation is only allowed in sources false otherwise
 
 - 
setSourceRetentionpublic void setSourceRetention(boolean flag) Sets the internal flag if the current annotation hasRetentionPolicy.SOURCE.- Parameters:
- flag- if true then current annotation is marked as having- RetentionPolicy.SOURCE.
 
 - 
hasClassRetentionpublic boolean hasClassRetention() Flag corresponding toRetentionPolicy.CLASS. This is the default when noRetentionPolicyannotations are present.- Returns:
- true if the annotation is written in the bytecode, but not visible at runtime false otherwise
 
 - 
setClassRetentionpublic void setClassRetention(boolean flag) Sets the internal flag if the current annotation has an explicitRetentionPolicy.CLASS.- Parameters:
- flag- if true then current annotation is marked as having- RetentionPolicy.CLASS.
 
 - 
setAllowedTargetspublic void setAllowedTargets(int bitmap) 
 - 
isTargetAllowedpublic boolean isTargetAllowed(int target) 
 - 
targetToNamepublic static String targetToName(int target) 
 
- 
 
-