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.
|
ExecutableElement |
defaultConstructorFor(TypeElement classElement) |
ExecutableElement |
defaultStaticCreatorFor(TypeElement classElement,
AnnotationUtils annotationUtils) |
Set<TypeElement> |
getAllInterfaces(TypeElement aClass) |
Types |
getTypeUtils() |
boolean |
isObjectClass(TypeElement element)
Return whether the given element is the java.lang.Object class.
|
boolean |
isPackagePrivate(Element element)
Returns whether an element is package private.
|
Optional<ExecutableElement> |
overridingOrHidingMethod(ExecutableElement overridden,
TypeElement classElement,
boolean strict)
Tests if candidate method is overridden from a given class or subclass.
|
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. |
ExecutableElement |
staticCreatorFor(TypeElement classElement,
AnnotationUtils annotationUtils)
The static method or Kotlin companion method to execute to
construct the given class element.
|
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 utilities@Nullable public ExecutableElement staticCreatorFor(TypeElement classElement, AnnotationUtils annotationUtils)
classElement
- The class elementannotationUtils
- The annotation utilitiespublic ExecutableElement defaultConstructorFor(TypeElement classElement)
classElement
- The class elementpublic ExecutableElement defaultStaticCreatorFor(TypeElement classElement, AnnotationUtils annotationUtils)
classElement
- The class elementannotationUtils
- The annotation utilspublic boolean isObjectClass(TypeElement element)
element
- The elementpublic boolean isPackagePrivate(Element element)
element
- The elementpublic Set<TypeElement> getAllInterfaces(TypeElement aClass)
aClass
- A classpublic Optional<ExecutableElement> overridingOrHidingMethod(ExecutableElement overridden, TypeElement classElement, boolean strict)
overridden
- the candidate overridden methodclassElement
- the type element that may contain the overriding method, either directly or in a subclassstrict
- Whether to use strict checks for overriding and not include logic to handle method overloadingpublic 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