com.sun.tools.jxc.apt
Class InlineAnnotationReaderImpl

java.lang.Object
  extended by com.sun.xml.bind.v2.model.annotation.AbstractInlineAnnotationReaderImpl<TypeMirror,TypeDeclaration,FieldDeclaration,MethodDeclaration>
      extended by com.sun.tools.jxc.apt.InlineAnnotationReaderImpl
All Implemented Interfaces:
AnnotationReader<TypeMirror,TypeDeclaration,FieldDeclaration,MethodDeclaration>

public final class InlineAnnotationReaderImpl
extends AbstractInlineAnnotationReaderImpl<TypeMirror,TypeDeclaration,FieldDeclaration,MethodDeclaration>

AnnotationReader implementation that reads annotation inline from APT.


Field Summary
static InlineAnnotationReaderImpl theInstance
          The singleton instance.
 
Method Summary
protected  java.lang.String fullName(MethodDeclaration m)
          Gets the fully-qualified name of the method.
 java.lang.annotation.Annotation[] getAllFieldAnnotations(FieldDeclaration field, Locatable srcPos)
          Gets all the annotations on a field.
 java.lang.annotation.Annotation[] getAllMethodAnnotations(MethodDeclaration method, Locatable srcPos)
          Gets all the annotations on a method.
<A extends java.lang.annotation.Annotation>
A
getClassAnnotation(java.lang.Class<A> a, TypeDeclaration clazz, Locatable srcPos)
          Reads an annotation on a class.
 TypeMirror[] getClassArrayValue(java.lang.annotation.Annotation a, java.lang.String name)
          Similar to AnnotationReader.getClassValue(Annotation, String) method but obtains an array parameter.
 TypeMirror getClassValue(java.lang.annotation.Annotation a, java.lang.String name)
          Reads a value of an annotation that returns a Class object.
<A extends java.lang.annotation.Annotation>
A
getFieldAnnotation(java.lang.Class<A> a, FieldDeclaration f, Locatable srcPos)
          Reads an annotation on a property that consists of a field.
<A extends java.lang.annotation.Annotation>
A
getMethodAnnotation(java.lang.Class<A> a, MethodDeclaration method, Locatable srcPos)
           
<A extends java.lang.annotation.Annotation>
A
getMethodParameterAnnotation(java.lang.Class<A> a, MethodDeclaration m, int paramIndex, Locatable srcPos)
          Reads an annotation on a parameter of the method.
<A extends java.lang.annotation.Annotation>
A
getPackageAnnotation(java.lang.Class<A> a, TypeDeclaration clazz, Locatable srcPos)
          Reads an annotation on the package that the given class belongs to.
 boolean hasClassAnnotation(TypeDeclaration clazz, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Checks if a class has the annotation.
 boolean hasFieldAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, FieldDeclaration f)
          Checks if the given field has an annotation.
 boolean hasMethodAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> a, MethodDeclaration method)
           
 
Methods inherited from class com.sun.xml.bind.v2.model.annotation.AbstractInlineAnnotationReaderImpl
getErrorHandler, getMethodAnnotation, hasMethodAnnotation, setErrorHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theInstance

public static final InlineAnnotationReaderImpl theInstance
The singleton instance.

Method Detail

getClassAnnotation

public <A extends java.lang.annotation.Annotation> A getClassAnnotation(java.lang.Class<A> a,
                                                                        TypeDeclaration clazz,
                                                                        Locatable srcPos)
Description copied from interface: AnnotationReader
Reads an annotation on a class.


getFieldAnnotation

public <A extends java.lang.annotation.Annotation> A getFieldAnnotation(java.lang.Class<A> a,
                                                                        FieldDeclaration f,
                                                                        Locatable srcPos)
Description copied from interface: AnnotationReader
Reads an annotation on a property that consists of a field.


hasFieldAnnotation

public boolean hasFieldAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType,
                                  FieldDeclaration f)
Description copied from interface: AnnotationReader
Checks if the given field has an annotation.


hasClassAnnotation

public boolean hasClassAnnotation(TypeDeclaration clazz,
                                  java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Description copied from interface: AnnotationReader
Checks if a class has the annotation.


getAllFieldAnnotations

public java.lang.annotation.Annotation[] getAllFieldAnnotations(FieldDeclaration field,
                                                                Locatable srcPos)
Description copied from interface: AnnotationReader
Gets all the annotations on a field.


getMethodAnnotation

public <A extends java.lang.annotation.Annotation> A getMethodAnnotation(java.lang.Class<A> a,
                                                                         MethodDeclaration method,
                                                                         Locatable srcPos)

hasMethodAnnotation

public boolean hasMethodAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> a,
                                   MethodDeclaration method)

getAllMethodAnnotations

public java.lang.annotation.Annotation[] getAllMethodAnnotations(MethodDeclaration method,
                                                                 Locatable srcPos)
Description copied from interface: AnnotationReader
Gets all the annotations on a method.

srcPos - the location from which this annotation is read.

getMethodParameterAnnotation

public <A extends java.lang.annotation.Annotation> A getMethodParameterAnnotation(java.lang.Class<A> a,
                                                                                  MethodDeclaration m,
                                                                                  int paramIndex,
                                                                                  Locatable srcPos)
Description copied from interface: AnnotationReader
Reads an annotation on a parameter of the method.

Returns:
null if the annotation was not found.

getPackageAnnotation

public <A extends java.lang.annotation.Annotation> A getPackageAnnotation(java.lang.Class<A> a,
                                                                          TypeDeclaration clazz,
                                                                          Locatable srcPos)
Description copied from interface: AnnotationReader
Reads an annotation on the package that the given class belongs to.


getClassValue

public TypeMirror getClassValue(java.lang.annotation.Annotation a,
                                java.lang.String name)
Description copied from interface: AnnotationReader
Reads a value of an annotation that returns a Class object.

Depending on the underlying reflection library, you can't always obtain the Class object directly (see the APT MirrorTypeException for example), so use this method to avoid that.

name - The name of the annotation parameter to be read.

getClassArrayValue

public TypeMirror[] getClassArrayValue(java.lang.annotation.Annotation a,
                                       java.lang.String name)
Description copied from interface: AnnotationReader
Similar to AnnotationReader.getClassValue(Annotation, String) method but obtains an array parameter.


fullName

protected java.lang.String fullName(MethodDeclaration m)
Description copied from class: AbstractInlineAnnotationReaderImpl
Gets the fully-qualified name of the method. Used for error messages.

Specified by:
fullName in class AbstractInlineAnnotationReaderImpl<TypeMirror,TypeDeclaration,FieldDeclaration,MethodDeclaration>