Modifier | Constructor and Description |
---|---|
protected |
ModelUtils(Elements elementUtils,
Types typeUtils) |
Modifier and Type | Method and Description |
---|---|
TypeElement |
classElementFor(Element element)
Obtains the
TypeElement for an given element. |
ExecutableElement |
concreteConstructorFor(TypeElement classElement,
AnnotationUtils annotationUtils)
The constructor inject for the given class element.
|
Types |
getTypeUtils() |
Optional<ElementKind> |
resolveKind(Element element)
The Java APT throws an internal exception {code com.sun.tools.javac.code.Symbol$CompletionFailure} if a class is missing from the classpath and
Element.getKind() is called. |
Optional<ElementKind> |
resolveKind(Element element,
ElementKind expected)
The Java APT throws an internal exception {code com.sun.tools.javac.code.Symbol$CompletionFailure} if a class is missing from the classpath and
Element.getKind() is called. |
public Types getTypeUtils()
@Nullable public final TypeElement classElementFor(Element element)
TypeElement
for an given element.element
- The elementTypeElement
@Nullable public ExecutableElement concreteConstructorFor(TypeElement classElement, AnnotationUtils annotationUtils)
classElement
- The class elementannotationUtils
- The annotation utilitiespublic Optional<ElementKind> resolveKind(Element element, ElementKind expected)
Element.getKind()
is called. This method
handles exceptions when calling the getKind() method to avoid this scenario and should be used instead of Element.getKind()
.element
- The elementexpected
- The expected kindpublic Optional<ElementKind> resolveKind(Element element)
Element.getKind()
is called. This method
handles exceptions when calling the getKind() method to avoid this scenario and should be used instead of Element.getKind()
.element
- The element