Package io.micronaut.inject.ast.utils
Class EnclosedElementsQuery<C,N>
java.lang.Object
io.micronaut.inject.ast.utils.EnclosedElementsQuery<C,N>
- Type Parameters:
C- The class native element typeN- The native element type
The elements query helper.
- Since:
- 4.0.0
- Author:
- Denis Stepanov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract booleanexcludeClass(C classNode) Checks if the class needs to be excluded.protected NgetCacheKey(N element) Get the cache key.protected abstract StringgetElementName(N element) Gets the element name.getEnclosedElements(C classNode, ElementQuery.Result<?> result) Extracts the enclosed elements of the class.getEnclosedElements(C classNode, ElementQuery.Result<?> result, boolean includeAbstract) Extracts the enclosed elements of the class.getEnclosedElements(ClassElement classElement, @NonNull ElementQuery<T> query) Return the elements that match the given query.getExcludedNativeElements(ElementQuery.Result<?> result) Provides a collection of the native elements to exclude.protected abstract @NonNull Collection<C>getInterfaces(C classNode) Extracts the interfaces of the class.protected CgetNativeClassType(ClassElement classElement) Get native class element.protected NgetNativeType(Element element) Get native element.protected abstract CgetSuperClass(C classNode) Extracts the super class.protected abstract booleanhasAnnotation(N element, Class<? extends Annotation> annotation) protected abstract booleanisAbstractClass(C classNode) Is abstract class.protected abstract booleanisInterface(C classNode) Is interface.protected abstract ElementtoAstElement(N nativeType, Class<?> elementType) Converts the native element to the AST element.
-
Constructor Details
-
EnclosedElementsQuery
public EnclosedElementsQuery()
-
-
Method Details
-
getNativeClassType
Get native class element.- Parameters:
classElement- The class element- Returns:
- The native element
-
getNativeType
Get native element.- Parameters:
element- The element- Returns:
- The native element
-
getEnclosedElements
public <T extends Element> List<T> getEnclosedElements(ClassElement classElement, @NonNull @NonNull ElementQuery<T> query) Return the elements that match the given query.- Type Parameters:
T- The element type- Parameters:
classElement- The class elementquery- The query to use.- Returns:
- The fields
-
hasAnnotation
-
getElementName
Gets the element name.- Parameters:
element- The element- Returns:
- The name
-
getCacheKey
Get the cache key.- Parameters:
element- The element- Returns:
- The cache key
-
getExcludedNativeElements
Provides a collection of the native elements to exclude.- Parameters:
result- The result- Returns:
- the collection of excluded elements
-
getSuperClass
Extracts the super class.- Parameters:
classNode- The class- Returns:
- The super calss
-
getInterfaces
Extracts the interfaces of the class.- Parameters:
classNode- The class- Returns:
- The interfaces
-
getEnclosedElements
@NonNull protected abstract @NonNull List<N> getEnclosedElements(C classNode, ElementQuery.Result<?> result, boolean includeAbstract) Extracts the enclosed elements of the class.- Parameters:
classNode- The classresult- The query resultincludeAbstract- If abstract/non-default elements should be included- Returns:
- The enclosed elements
-
getEnclosedElements
Extracts the enclosed elements of the class.- Parameters:
classNode- The classresult- The query result- Returns:
- The enclosed elements
-
excludeClass
Checks if the class needs to be excluded.- Parameters:
classNode- The class- Returns:
- true if to exclude
-
isAbstractClass
Is abstract class.- Parameters:
classNode- The class node- Returns:
- true if abstract
- Since:
- 4.3.0
-
isInterface
Is interface.- Parameters:
classNode- The class node- Returns:
- true if interface
- Since:
- 4.3.0
-
toAstElement
Converts the native element to the AST element.- Parameters:
nativeType- The native element.elementType- The result type- Returns:
- The AST element
-