Class AnnotationImpl
- java.lang.Object
-
- org.apache.xmlbeans.impl.jam.internal.elements.ElementImpl
-
- org.apache.xmlbeans.impl.jam.internal.elements.AnnotationImpl
-
- All Implemented Interfaces:
java.lang.Comparable,JAnnotation,JElement,MAnnotation,MElement
public final class AnnotationImpl extends ElementImpl implements MAnnotation
Standard implementation of AnnotationImpl.
-
-
Field Summary
-
Fields inherited from class org.apache.xmlbeans.impl.jam.internal.elements.ElementImpl
NO_ANNOTATION, NO_CLASS, NO_COMMENT, NO_CONSTRUCTOR, NO_FIELD, NO_METHOD, NO_NODE, NO_PACKAGE, NO_PARAMETER, NO_PROPERTY
-
Fields inherited from interface org.apache.xmlbeans.impl.jam.JAnnotation
SINGLE_VALUE_NAME
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(JVisitor visitor)Accepts the given visitor.voidaccept(MVisitor visitor)MAnnotationcreateNestedValue(java.lang.String name, java.lang.String annTypeName)MAnnotation[]createNestedValueArray(java.lang.String name, java.lang.String annComponentTypeName, int dimensions)java.lang.ObjectgetAnnotationInstance()If this JAnnotation corresponds to metadata that is stored in a JSR175 annotation (i.e.java.lang.ObjectgetProxy()If a typed annotation proxy has been registered for the annotation represented by this JAnnotation, returns this object.java.lang.StringgetQualifiedName()Returns a qualified name for this abstraction.JAnnotationValuegetValue(java.lang.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.voidsetAnnotationInstance(java.lang.Object o)voidsetSimpleValue(java.lang.String name, java.lang.Object value, JClass type)-
Methods inherited from class org.apache.xmlbeans.impl.jam.internal.elements.ElementImpl
compareTo, createSourcePosition, defaultName, equals, getArtifact, getClassLoader, getContext, getMutableSourcePosition, getParent, getSimpleName, getSourcePosition, hashCode, removeSourcePosition, setArtifact, setSimpleName, toString
-
Methods inherited from interface org.apache.xmlbeans.impl.jam.JAnnotation
getSimpleName
-
Methods inherited from interface org.apache.xmlbeans.impl.jam.JElement
getArtifact, getParent, getSourcePosition, toString
-
Methods inherited from interface org.apache.xmlbeans.impl.jam.mutable.MElement
createSourcePosition, getClassLoader, getMutableSourcePosition, removeSourcePosition, setArtifact, setSimpleName
-
-
-
-
Method Detail
-
getProxy
public java.lang.Object getProxy()
Description copied from interface: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.
- Specified by:
getProxyin interfaceJAnnotation
-
getValues
public JAnnotationValue[] getValues()
Description copied from interface:JAnnotationReturns an array of this annotation's member values.
- Specified by:
getValuesin interfaceJAnnotation
-
getValue
public JAnnotationValue getValue(java.lang.String name)
Description copied from interface:JAnnotationReturns a structure which provides untyped, "by-name" access to the value of the named annotation member.
- Specified by:
getValuein interfaceJAnnotation
-
getAnnotationInstance
public java.lang.Object getAnnotationInstance()
Description copied from interface: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 asObjectsimply to preserve API compatibility with Java 1.4.- Specified by:
getAnnotationInstancein interfaceJAnnotation
-
setAnnotationInstance
public void setAnnotationInstance(java.lang.Object o)
- Specified by:
setAnnotationInstancein interfaceMAnnotation
-
setSimpleValue
public void setSimpleValue(java.lang.String name, java.lang.Object value, JClass type)- Specified by:
setSimpleValuein interfaceMAnnotation
-
createNestedValue
public MAnnotation createNestedValue(java.lang.String name, java.lang.String annTypeName)
- Specified by:
createNestedValuein interfaceMAnnotation
-
createNestedValueArray
public MAnnotation[] createNestedValueArray(java.lang.String name, java.lang.String annComponentTypeName, int dimensions)
- Specified by:
createNestedValueArrayin interfaceMAnnotation
-
getQualifiedName
public java.lang.String getQualifiedName()
Description copied from interface: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.
- Specified by:
getQualifiedNamein interfaceJElement
-
-