public final class AnnotationImpl extends ElementImpl implements MAnnotation
Standard implementation of AnnotationImpl.
NO_ANNOTATION, NO_CLASS, NO_COMMENT, NO_CONSTRUCTOR, NO_FIELD, NO_METHOD, NO_NODE, NO_PACKAGE, NO_PARAMETER, NO_PROPERTYSINGLE_VALUE_NAME| Modifier and Type | Method and Description |
|---|---|
void |
accept(JVisitor visitor)
Accepts the given visitor.
|
void |
accept(MVisitor visitor) |
MAnnotation |
createNestedValue(String name,
String annTypeName) |
MAnnotation[] |
createNestedValueArray(String name,
String annComponentTypeName,
int dimensions) |
Object |
getAnnotationInstance()
If this JAnnotation corresponds to metadata that is stored in
a JSR175 annotation (i.e.
|
Object |
getProxy()
If a typed annotation proxy has been registered for the annotation
represented by this JAnnotation, returns this object.
|
String |
getQualifiedName()
Returns a qualified name for this abstraction.
|
JAnnotationValue |
getValue(String name)
Returns a structure which provides untyped, "by-name" access to
the value of the named annotation member.
|
JAnnotationValue[] |
getValues()
Returns an array of this annotation's member values.
|
void |
setAnnotationInstance(Object o) |
void |
setSimpleValue(String name,
Object value,
JClass type) |
compareTo, createSourcePosition, defaultName, equals, getArtifact, getClassLoader, getContext, getMutableSourcePosition, getParent, getSimpleName, getSourcePosition, hashCode, removeSourcePosition, setArtifact, setSimpleName, toStringgetSimpleNamecreateSourcePosition, getClassLoader, getMutableSourcePosition, removeSourcePosition, setArtifact, setSimpleNamegetArtifact, getParent, getSourcePosition, toStringpublic Object getProxy()
JAnnotationIf a typed annotation proxy has been registered for the annotation represented by this JAnnotation, returns this object. Note that it's usually easier to access proxies by simply calling JAnnotatedElement.getAnnotationProxy(proxyClass).
The value returned is guaranteed to be either a user-defined subclass of TypedAnnotationProxyBase or null.
getProxy in interface JAnnotationpublic JAnnotationValue[] getValues()
JAnnotationReturns an array of this annotation's member values.
getValues in interface JAnnotationpublic JAnnotationValue getValue(String name)
JAnnotationReturns a structure which provides untyped, "by-name" access to the value of the named annotation member.
getValue in interface JAnnotationpublic Object getAnnotationInstance()
JAnnotationIf this JAnnotation corresponds to metadata that is stored in a JSR175 annotation (i.e. an instance of java.lang.annotation.Annotation), returns that annotation object. Returns null if the annotation does not exist or is otherwise unavailable.
Note that this is done only on a best-effort basis - the annotation object not be availble under pre-1.5 JREs and will generally only be available if the underlying annotation was view from a class file. Note that the retention policy of the annotation type usually must also be RUNTIME. Unless you are sure of all of these things, you are better off using an AnnotationProxy or the untyped value accessors (e.g. getValues()).
If this method does return something other than null, it is guaranteed
to be an instance of java.lang.annotation.Annotation. It
is typed here as Object simply to preserve API compatibility
with Java 1.4.
getAnnotationInstance in interface JAnnotationpublic void setAnnotationInstance(Object o)
setAnnotationInstance in interface MAnnotationpublic void setSimpleValue(String name, Object value, JClass type)
setSimpleValue in interface MAnnotationpublic MAnnotation createNestedValue(String name, String annTypeName)
createNestedValue in interface MAnnotationpublic MAnnotation[] createNestedValueArray(String name, String annComponentTypeName, int dimensions)
createNestedValueArray in interface MAnnotationpublic String getQualifiedName()
JElementReturns a qualified name for this abstraction. The exact format of this name depends on the particular abstraction. Please refer to the documentation for each JElement subclass for a detailed description of the qualified name formats.
getQualifiedName in interface JElementCopyright © 2010 - 2020 Adobe. All Rights Reserved