Class EnclosedElementsQuery<C,N>

java.lang.Object
io.micronaut.inject.ast.utils.EnclosedElementsQuery<C,N>
Type Parameters:
C - The class native element type
N - The native element type

@Internal public abstract class EnclosedElementsQuery<C,N> extends Object
The elements query helper.
Since:
4.0.0
Author:
Denis Stepanov
  • Constructor Details

    • EnclosedElementsQuery

      public EnclosedElementsQuery()
  • Method Details

    • getNativeClassType

      protected C getNativeClassType(ClassElement classElement)
      Get native class element.
      Parameters:
      classElement - The class element
      Returns:
      The native element
    • getNativeType

      protected N getNativeType(Element element)
      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 element
      query - The query to use.
      Returns:
      The fields
    • getElementName

      protected abstract String getElementName(N element)
      Gets the element name.
      Parameters:
      element - The element
      Returns:
      The name
    • getCacheKey

      protected N getCacheKey(N element)
      Get the cache key.
      Parameters:
      element - The element
      Returns:
      The cache key
    • getExcludedNativeElements

      protected Set<N> getExcludedNativeElements(@NonNull ElementQuery.Result<?> result)
      Provides a collection of the native elements to exclude.
      Parameters:
      result - The result
      Returns:
      the collection of excluded elements
    • getSuperClass

      @Nullable protected abstract C getSuperClass(C classNode)
      Extracts the super class.
      Parameters:
      classNode - The class
      Returns:
      The super calss
    • getInterfaces

      @NonNull protected abstract @NonNull Collection<C> getInterfaces(C classNode)
      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)
      Extracts the enclosed elements of the class.
      Parameters:
      classNode - The class
      result - The query result
      Returns:
      The enclosed elements
    • excludeClass

      protected abstract boolean excludeClass(C classNode)
      Checks if the class needs to be excluded.
      Parameters:
      classNode - The class
      Returns:
      true if to exclude
    • toAstElement

      @NonNull protected abstract Element toAstElement(N nativeType, Class<?> elementType)
      Converts the native element to the AST element.
      Parameters:
      nativeType - The native element.
      elementType - The result type
      Returns:
      The AST element