Class ModelUtils
java.lang.Object
io.micronaut.annotation.processing.ModelUtils
Provides utility method for working with the annotation processor AST.
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal @Nullable TypeElement
classElementFor
(Element element) Obtains theTypeElement
for a given element.getAllInterfaces
(TypeElement aClass) boolean
isObjectClass
(TypeElement element) Return whether the given element is the java.lang.Object class.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 andElement.getKind()
is called.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 andElement.getKind()
is called.resolveTypeElements
(Set<? extends Element> annotatedElements) Resolves type elements from the provided annotated elements.
-
Constructor Details
-
Method Details
-
getTypeUtils
- Returns:
- The type utilities
-
resolveTypeElements
Resolves type elements from the provided annotated elements.- Parameters:
annotatedElements
- The elements to process- Returns:
- the type elements
-
classElementFor
Obtains theTypeElement
for a given element.- Parameters:
element
- The element- Returns:
- The
TypeElement
-
isObjectClass
Return whether the given element is the java.lang.Object class.- Parameters:
element
- The element- Returns:
- True if it is java.lang.Object
-
getAllInterfaces
- Parameters:
aClass
- A class- Returns:
- All the interfaces
-
resolveKind
The Java APT throws an internal exception {code com.sun.tools.javac.code.Symbol$CompletionFailure} if a class is missing from the classpath andElement.getKind()
is called. This method handles exceptions when calling the getKind() method to avoid this scenario and should be used instead ofElement.getKind()
.- Parameters:
element
- The elementexpected
- The expected kind- Returns:
- The kind if it is resolvable and matches the expected kind
-
resolveKind
The Java APT throws an internal exception {code com.sun.tools.javac.code.Symbol$CompletionFailure} if a class is missing from the classpath andElement.getKind()
is called. This method handles exceptions when calling the getKind() method to avoid this scenario and should be used instead ofElement.getKind()
.- Parameters:
element
- The element- Returns:
- The kind if it is resolvable
-