public class AnnotationApiHelper extends Object
| Constructor and Description |
|---|
AnnotationApiHelper(javax.lang.model.util.Elements elementUtils,
javax.lang.model.util.Types typeUtils) |
| Modifier and Type | Method and Description |
|---|---|
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.type.DeclaredType |
getDeclaredTypeByName(String className)
Returns the
DeclaredType for the given class 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.
|
public AnnotationApiHelper(javax.lang.model.util.Elements elementUtils,
javax.lang.model.util.Types typeUtils)
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.public javax.lang.model.type.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 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, Settypes - A set of type mirrors.Copyright © 2007-2012 Red Hat Middleware, LLC. All Rights Reserved