|
||||||||||
| 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(javax.lang.model.util.Elements elementUtils,
javax.lang.model.util.Types typeUtils)
|
|
| Method Summary | |
|---|---|
List<javax.lang.model.element.AnnotationMirror> |
filterByType(List<? extends javax.lang.model.element.AnnotationMirror> annotationMirrors,
javax.lang.model.type.TypeMirror annotationType)
Returns a list containing those annotation mirrors from the input list, which are of type annotationType. |
List<? extends javax.lang.model.element.AnnotationValue> |
getAnnotationArrayValue(javax.lang.model.element.AnnotationMirror annotationMirror,
String name)
Returns the given annotation mirror's array-typed annotation value with the given name. |
javax.lang.model.element.AnnotationValue |
getAnnotationValue(javax.lang.model.element.AnnotationMirror annotationMirror,
String name)
Returns the annotation value of the given annotation mirror with the given name. |
javax.lang.model.element.AnnotationMirror |
getMirror(List<? extends javax.lang.model.element.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. |
javax.lang.model.type.TypeMirror |
getMirrorForType(Class<?> clazz)
Returns a TypeMirror for the given class. |
Set<javax.lang.model.type.TypeMirror> |
keepLowestTypePerHierarchy(Set<javax.lang.model.type.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(javax.lang.model.util.Elements elementUtils,
javax.lang.model.util.Types typeUtils)
| Method Detail |
|---|
public List<javax.lang.model.element.AnnotationMirror> filterByType(List<? extends javax.lang.model.element.AnnotationMirror> annotationMirrors,
javax.lang.model.type.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 javax.lang.model.element.AnnotationMirror getMirror(List<? extends javax.lang.model.element.AnnotationMirror> annotationMirrors,
Class<? extends Annotation> annotationClazz)
annotationMirrors - A list of annotation mirrors.annotationClazz - The class of the annotation of interest.
public javax.lang.model.type.TypeMirror getMirrorForType(Class<?> clazz)
clazz - The class of interest. May not be a an array type.
public javax.lang.model.element.AnnotationValue getAnnotationValue(javax.lang.model.element.AnnotationMirror annotationMirror,
String name)
annotationMirror - An annotation mirror.name - The name of the annotation value of interest.
public List<? extends javax.lang.model.element.AnnotationValue> getAnnotationArrayValue(javax.lang.model.element.AnnotationMirror annotationMirror,
String name)
annotationMirror - An annotation mirror.name - The name of the annotation value of interest.
public Set<javax.lang.model.type.TypeMirror> keepLowestTypePerHierarchy(Set<javax.lang.model.type.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: StringObject, String; Output:
StringObject, Collection, List;
Output: ListCollection, 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 | |||||||||