com.sun.tools.jxc.ap
Class InlineAnnotationReaderImpl

java.lang.Object
  extended by com.sun.xml.bind.v2.model.annotation.AbstractInlineAnnotationReaderImpl<javax.lang.model.type.TypeMirror,javax.lang.model.element.TypeElement,javax.lang.model.element.VariableElement,javax.lang.model.element.ExecutableElement>
      extended by com.sun.tools.jxc.ap.InlineAnnotationReaderImpl
All Implemented Interfaces:
AnnotationReader<javax.lang.model.type.TypeMirror,javax.lang.model.element.TypeElement,javax.lang.model.element.VariableElement,javax.lang.model.element.ExecutableElement>

public final class InlineAnnotationReaderImpl
extends AbstractInlineAnnotationReaderImpl<javax.lang.model.type.TypeMirror,javax.lang.model.element.TypeElement,javax.lang.model.element.VariableElement,javax.lang.model.element.ExecutableElement>

AnnotationReader implementation that reads annotation inline from Annoation Processing.

Author:
Kohsuke Kawaguchi (kk@kohsuke.org)

Field Summary
static InlineAnnotationReaderImpl theInstance
          The singleton instance.
 
Method Summary
protected  String fullName(javax.lang.model.element.ExecutableElement m)
          Gets the fully-qualified name of the method.
 Annotation[] getAllFieldAnnotations(javax.lang.model.element.VariableElement field, Locatable srcPos)
          Gets all the annotations on a field.
 Annotation[] getAllMethodAnnotations(javax.lang.model.element.ExecutableElement method, Locatable srcPos)
          Gets all the annotations on a method.
<A extends Annotation>
A
getClassAnnotation(Class<A> a, javax.lang.model.element.TypeElement clazz, Locatable srcPos)
          Reads an annotation on a class.
 javax.lang.model.type.TypeMirror[] getClassArrayValue(Annotation a, String name)
          Similar to AnnotationReader.getClassValue(Annotation, String) method but obtains an array parameter.
 javax.lang.model.type.TypeMirror getClassValue(Annotation a, String name)
          Reads a value of an annotation that returns a Class object.
<A extends Annotation>
A
getFieldAnnotation(Class<A> a, javax.lang.model.element.VariableElement f, Locatable srcPos)
          Reads an annotation on a property that consists of a field.
<A extends Annotation>
A
getMethodAnnotation(Class<A> a, javax.lang.model.element.ExecutableElement method, Locatable srcPos)
           
<A extends Annotation>
A
getMethodParameterAnnotation(Class<A> a, javax.lang.model.element.ExecutableElement m, int paramIndex, Locatable srcPos)
          Reads an annotation on a parameter of the method.
<A extends Annotation>
A
getPackageAnnotation(Class<A> a, javax.lang.model.element.TypeElement clazz, Locatable srcPos)
          Reads an annotation on the package that the given class belongs to.
 boolean hasClassAnnotation(javax.lang.model.element.TypeElement clazz, Class<? extends Annotation> annotationType)
          Checks if a class has the annotation.
 boolean hasFieldAnnotation(Class<? extends Annotation> annotationType, javax.lang.model.element.VariableElement f)
          Checks if the given field has an annotation.
 boolean hasMethodAnnotation(Class<? extends Annotation> a, javax.lang.model.element.ExecutableElement 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 Annotation> A getClassAnnotation(Class<A> a,
                                                   javax.lang.model.element.TypeElement clazz,
                                                   Locatable srcPos)
Description copied from interface: AnnotationReader
Reads an annotation on a class.


getFieldAnnotation

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


hasFieldAnnotation

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


hasClassAnnotation

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


getAllFieldAnnotations

public Annotation[] getAllFieldAnnotations(javax.lang.model.element.VariableElement field,
                                           Locatable srcPos)
Description copied from interface: AnnotationReader
Gets all the annotations on a field.


getMethodAnnotation

public <A extends Annotation> A getMethodAnnotation(Class<A> a,
                                                    javax.lang.model.element.ExecutableElement method,
                                                    Locatable srcPos)

hasMethodAnnotation

public boolean hasMethodAnnotation(Class<? extends Annotation> a,
                                   javax.lang.model.element.ExecutableElement method)

getAllMethodAnnotations

public Annotation[] getAllMethodAnnotations(javax.lang.model.element.ExecutableElement 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 Annotation> A getMethodParameterAnnotation(Class<A> a,
                                                             javax.lang.model.element.ExecutableElement 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 Annotation> A getPackageAnnotation(Class<A> a,
                                                     javax.lang.model.element.TypeElement clazz,
                                                     Locatable srcPos)
Description copied from interface: AnnotationReader
Reads an annotation on the package that the given class belongs to.


getClassValue

public javax.lang.model.type.TypeMirror getClassValue(Annotation a,
                                                      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 Annotation Processing MirrorTypeException for example), so use this method to avoid that.

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

getClassArrayValue

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


fullName

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

Specified by:
fullName in class AbstractInlineAnnotationReaderImpl<javax.lang.model.type.TypeMirror,javax.lang.model.element.TypeElement,javax.lang.model.element.VariableElement,javax.lang.model.element.ExecutableElement>


Copyright © 2005-2012 Oracle Corporation. All Rights Reserved.