|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hibernate.validator.ap.util.AnnotationApiHelper
public class AnnotationApiHelper
A helper class providing some useful methods to work with types from the JSR-269-API.
Constructor Summary | |
---|---|
AnnotationApiHelper(Elements elementUtils,
Types typeUtils)
|
Method Summary | |
---|---|
List<AnnotationMirror> |
filterByType(List<? extends AnnotationMirror> annotationMirrors,
TypeMirror annotationType)
Returns a list containing those annotation mirrors from the input list, which are of type annotationType . |
List<? extends AnnotationValue> |
getAnnotationArrayValue(AnnotationMirror annotationMirror,
String name)
Returns the given annotation mirror's array-typed annotation value with the given name. |
AnnotationValue |
getAnnotationValue(AnnotationMirror annotationMirror,
String name)
Returns the annotation value of the given annotation mirror with the given name. |
DeclaredType |
getDeclaredTypeByName(String className)
Returns the DeclaredType for the given class name. |
AnnotationMirror |
getMirror(List<? extends AnnotationMirror> annotationMirrors,
Class<? extends Annotation> annotationClazz)
Returns that mirror from the given list of annotation mirrors that represents the annotation type specified by the given class. |
TypeMirror |
getMirrorForType(Class<?> clazz)
Returns a TypeMirror for the given class. |
Set<TypeMirror> |
keepLowestTypePerHierarchy(Set<TypeMirror> types)
Returns a set containing the "lowest" type per hierarchy contained in the input set. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AnnotationApiHelper(Elements elementUtils, Types typeUtils)
Method Detail |
---|
public List<AnnotationMirror> filterByType(List<? extends AnnotationMirror> annotationMirrors, TypeMirror annotationType)
annotationType
. The input collection
remains untouched.
annotationMirrors
- A list of annotation mirrors.annotationType
- The type to be compared against.
annotationType
. May be empty but never
null.public AnnotationMirror getMirror(List<? extends AnnotationMirror> annotationMirrors, Class<? extends Annotation> annotationClazz)
annotationMirrors
- A list of annotation mirrors.annotationClazz
- The class of the annotation of interest.
public TypeMirror getMirrorForType(Class<?> clazz)
clazz
- The class of interest.
public DeclaredType getDeclaredTypeByName(String className)
DeclaredType
for the given class name.
className
- A fully qualified class name, e.g. "java.lang.String".
DeclaredType
representing the type with the given name,
or null, if no such type exists.public AnnotationValue getAnnotationValue(AnnotationMirror annotationMirror, String name)
annotationMirror
- An annotation mirror.name
- The name of the annotation value of interest.
public List<? extends AnnotationValue> getAnnotationArrayValue(AnnotationMirror annotationMirror, String name)
annotationMirror
- An annotation mirror.name
- The name of the annotation value of interest.
public Set<TypeMirror> keepLowestTypePerHierarchy(Set<TypeMirror> types)
Returns a set containing the "lowest" type per hierarchy contained in the input set. The following examples shall demonstrate the behavior.
String
; Output: String
Object
, String
; Output:
String
Object
, Collection
, List
;
Output: List
Collection
, Set
, List
;
Output: List
, Set
types
- A set of type mirrors.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |