Class RuntimeInlineAnnotationReader
- java.lang.Object
-
- com.sun.xml.bind.v2.model.annotation.AbstractInlineAnnotationReaderImpl<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method>
-
- com.sun.xml.bind.v2.model.annotation.RuntimeInlineAnnotationReader
-
- All Implemented Interfaces:
AnnotationReader<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method>,RuntimeAnnotationReader
public final class RuntimeInlineAnnotationReader extends AbstractInlineAnnotationReaderImpl<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method> implements RuntimeAnnotationReader
AnnotationReaderthat usesjava.lang.reflectto read annotations from class files.- Author:
- Kohsuke Kawaguchi (kk@kohsuke.org)
-
-
Constructor Summary
Constructors Constructor Description RuntimeInlineAnnotationReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringfullName(java.lang.reflect.Method m)Gets the fully-qualified name of the method.java.lang.annotation.Annotation[]getAllFieldAnnotations(java.lang.reflect.Field field, Locatable srcPos)Gets all the annotations on a field.java.lang.annotation.Annotation[]getAllMethodAnnotations(java.lang.reflect.Method method, Locatable srcPos)Gets all the annotations on a method.<A extends java.lang.annotation.Annotation>
AgetClassAnnotation(java.lang.Class<A> a, java.lang.Class clazz, Locatable srcPos)Reads an annotation on a class.java.lang.Class[]getClassArrayValue(java.lang.annotation.Annotation a, java.lang.String name)Similar toAnnotationReader.getClassValue(Annotation, String)method but obtains an array parameter.java.lang.ClassgetClassValue(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>
AgetFieldAnnotation(java.lang.Class<A> annotation, java.lang.reflect.Field field, Locatable srcPos)Reads an annotation on a property that consists of a field.<A extends java.lang.annotation.Annotation>
AgetMethodAnnotation(java.lang.Class<A> annotation, java.lang.reflect.Method method, Locatable srcPos)<A extends java.lang.annotation.Annotation>
AgetMethodParameterAnnotation(java.lang.Class<A> annotation, java.lang.reflect.Method method, int paramIndex, Locatable srcPos)Reads an annotation on a parameter of the method.<A extends java.lang.annotation.Annotation>
AgetPackageAnnotation(java.lang.Class<A> a, java.lang.Class clazz, Locatable srcPos)Reads an annotation on the package that the given class belongs to.booleanhasClassAnnotation(java.lang.Class clazz, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)Checks if a class has the annotation.booleanhasFieldAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, java.lang.reflect.Field field)Checks if the given field has an annotation.booleanhasMethodAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.reflect.Method 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
-
Methods inherited from interface com.sun.xml.bind.v2.model.annotation.AnnotationReader
getMethodAnnotation, hasMethodAnnotation, setErrorHandler
-
-
-
-
Method Detail
-
getFieldAnnotation
public <A extends java.lang.annotation.Annotation> A getFieldAnnotation(java.lang.Class<A> annotation, java.lang.reflect.Field field, Locatable srcPos)Description copied from interface:AnnotationReaderReads an annotation on a property that consists of a field.- Specified by:
getFieldAnnotationin interfaceAnnotationReader<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method>
-
hasFieldAnnotation
public boolean hasFieldAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, java.lang.reflect.Field field)Description copied from interface:AnnotationReaderChecks if the given field has an annotation.- Specified by:
hasFieldAnnotationin interfaceAnnotationReader<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method>
-
hasClassAnnotation
public boolean hasClassAnnotation(java.lang.Class clazz, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)Description copied from interface:AnnotationReaderChecks if a class has the annotation.- Specified by:
hasClassAnnotationin interfaceAnnotationReader<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method>
-
getAllFieldAnnotations
public java.lang.annotation.Annotation[] getAllFieldAnnotations(java.lang.reflect.Field field, Locatable srcPos)Description copied from interface:AnnotationReaderGets all the annotations on a field.- Specified by:
getAllFieldAnnotationsin interfaceAnnotationReader<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method>
-
getMethodAnnotation
public <A extends java.lang.annotation.Annotation> A getMethodAnnotation(java.lang.Class<A> annotation, java.lang.reflect.Method method, Locatable srcPos)- Specified by:
getMethodAnnotationin interfaceAnnotationReader<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method>
-
hasMethodAnnotation
public boolean hasMethodAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.reflect.Method method)- Specified by:
hasMethodAnnotationin interfaceAnnotationReader<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method>
-
getAllMethodAnnotations
public java.lang.annotation.Annotation[] getAllMethodAnnotations(java.lang.reflect.Method method, Locatable srcPos)Description copied from interface:AnnotationReaderGets all the annotations on a method.- Specified by:
getAllMethodAnnotationsin interfaceAnnotationReader<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method>srcPos- the location from which this annotation is read.
-
getMethodParameterAnnotation
public <A extends java.lang.annotation.Annotation> A getMethodParameterAnnotation(java.lang.Class<A> annotation, java.lang.reflect.Method method, int paramIndex, Locatable srcPos)Description copied from interface:AnnotationReaderReads an annotation on a parameter of the method.- Specified by:
getMethodParameterAnnotationin interfaceAnnotationReader<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method>- Returns:
- null if the annotation was not found.
-
getClassAnnotation
public <A extends java.lang.annotation.Annotation> A getClassAnnotation(java.lang.Class<A> a, java.lang.Class clazz, Locatable srcPos)Description copied from interface:AnnotationReaderReads an annotation on a class.- Specified by:
getClassAnnotationin interfaceAnnotationReader<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method>
-
getPackageAnnotation
public <A extends java.lang.annotation.Annotation> A getPackageAnnotation(java.lang.Class<A> a, java.lang.Class clazz, Locatable srcPos)Description copied from interface:AnnotationReaderReads an annotation on the package that the given class belongs to.- Specified by:
getPackageAnnotationin interfaceAnnotationReader<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method>
-
getClassValue
public java.lang.Class getClassValue(java.lang.annotation.Annotation a, java.lang.String name)Description copied from interface:AnnotationReaderReads a value of an annotation that returns a Class object.Depending on the underlying reflection library, you can't always obtain the
Classobject directly (see the Annotation Processing MirrorTypeException for example), so use this method to avoid that.- Specified by:
getClassValuein interfaceAnnotationReader<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method>name- The name of the annotation parameter to be read.
-
getClassArrayValue
public java.lang.Class[] getClassArrayValue(java.lang.annotation.Annotation a, java.lang.String name)Description copied from interface:AnnotationReaderSimilar toAnnotationReader.getClassValue(Annotation, String)method but obtains an array parameter.- Specified by:
getClassArrayValuein interfaceAnnotationReader<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method>
-
fullName
protected java.lang.String fullName(java.lang.reflect.Method m)
Description copied from class:AbstractInlineAnnotationReaderImplGets the fully-qualified name of the method. Used for error messages.- Specified by:
fullNamein classAbstractInlineAnnotationReaderImpl<java.lang.reflect.Type,java.lang.Class,java.lang.reflect.Field,java.lang.reflect.Method>
-
-