Class FilteringQualifier<T>

java.lang.Object
io.micronaut.inject.qualifiers.FilteringQualifier<T>
Type Parameters:
T - The qualifier type
All Implemented Interfaces:
Qualifier<T>
Direct Known Subclasses:
AnyQualifier, EachBeanQualifier, InterceptorBindingQualifier, PrimaryQualifier, TypeAnnotationQualifier, TypeArgumentQualifier

@Internal public abstract class FilteringQualifier<T> extends Object implements Qualifier<T>
A variation of Qualifier that is a simple filter.
Since:
4.2.0
Author:
Denis Stepanov
  • Constructor Details

    • FilteringQualifier

      public FilteringQualifier()
  • Method Details

    • getIndexedArgument

      @Nullable public @Nullable Argument<?> getIndexedArgument()
      The type the beans this qualifier selects are indexed by, when the compile-time index is an exhaustive answer for it. A qualifier that reports one can be answered by looking that type up in the index instead of filtering every bean definition reference.

      An Argument rather than a Class so that the qualifier holds the one the index is keyed by, instead of a new one being built on every lookup.

      Returns:
      The indexed type, or null when the qualifier has to be answered by filtering
      Since:
      5.2.0
    • reduce

      public <BT extends BeanType<T>> Stream<BT> reduce(Class<T> beanType, Stream<BT> candidates)
      Specified by:
      reduce in interface Qualifier<T>
      Type Parameters:
      BT - The bean type subclass
      Parameters:
      beanType - The bean type
      candidates - The candidates
      Returns:
      The qualified candidate or null it cannot be qualified
    • doesQualify

      public boolean doesQualify(Class<T> beanType, Collection<? extends BeanType<T>> candidates)
      Description copied from interface: Qualifier
      Check if at least one candidate qualifies.
      Specified by:
      doesQualify in interface Qualifier<T>
      Parameters:
      beanType - The bean type
      candidates - The candidates
      Returns:
      true if qualifies
    • doesQualifyQualified

      public boolean doesQualifyQualified(Class<T> beanType, Collection<? extends QualifiedBeanType<T>> candidates)
      Description copied from interface: Qualifier
      Check if at least one candidate qualifies.
      Specified by:
      doesQualifyQualified in interface Qualifier<T>
      Parameters:
      beanType - The bean type
      candidates - The candidates
      Returns:
      true if qualifies
    • filter

      public <BT extends BeanType<T>> Collection<BT> filter(Class<T> beanType, Collection<BT> candidates)
      Description copied from interface: Qualifier
      Filter the candidates.
      Specified by:
      filter in interface Qualifier<T>
      Type Parameters:
      BT - The bean type subclass
      Parameters:
      beanType - The bean type
      candidates - The candidates
      Returns:
      The filtered candidates
    • filterQualified

      public <BT extends QualifiedBeanType<T>> Collection<BT> filterQualified(Class<T> beanType, Collection<BT> candidates)
      Description copied from interface: Qualifier
      Filter the qualified candidates.
      Specified by:
      filterQualified in interface Qualifier<T>
      Type Parameters:
      BT - The bean type subclass
      Parameters:
      beanType - The bean type
      candidates - The candidates
      Returns:
      The filtered candidates