public class ElementUtil extends Object
| 构造器和说明 |
|---|
ElementUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static <T extends Annotation> |
getAnnotationClassValue(Elements elements,
T anno,
java.util.function.Function<T,Class<?>> func)
For Class attribute, if we invoke directly, it will throw
MirroredTypeException. |
static Optional<AnnotationMirror> |
getAnnotationMirror(Element element,
Class<? extends Annotation> annotationClass)
Get
AnnotationMirror from given element with given type |
static Optional<AnnotationMirror> |
getAnnotationMirror(Element element,
String annoClzCanonicalName)
Get
AnnotationMirror from given element with given annotation name |
static Optional<AnnotationMirror> |
getAnnotationMirror(Element element,
TypeMirror annotationType)
Get
AnnotationMirror from given element with given type |
public static <T extends Annotation> TypeMirror getAnnotationClassValue(Elements elements, T anno, java.util.function.Function<T,Class<?>> func)
MirroredTypeException. Use this method to get the
Class value safely.elements - Elements for convert Class to TypeMirroranno - annotation objectfunc - the invocation of get Class valueTypeMirrorpublic static Optional<AnnotationMirror> getAnnotationMirror(Element element, Class<? extends Annotation> annotationClass)
AnnotationMirror from given element with given typeelement - the element to find annotationannotationClass - the annotation classpublic static Optional<AnnotationMirror> getAnnotationMirror(Element element, TypeMirror annotationType)
AnnotationMirror from given element with given typeelement - the element to find annotationannotationType - the annotation TypeMirrorpublic static Optional<AnnotationMirror> getAnnotationMirror(Element element, String annoClzCanonicalName)
AnnotationMirror from given element with given annotation nameelement - the element to find annotationannoClzCanonicalName - the annotation nameCopyright © 2017. All rights reserved.