Class ClosestTypeArgumentQualifier<T>

java.lang.Object
io.micronaut.inject.qualifiers.TypeArgumentQualifier<T>
io.micronaut.inject.qualifiers.ClosestTypeArgumentQualifier<T>
Type Parameters:
T - The type
All Implemented Interfaces:
Qualifier<T>

@Internal public class ClosestTypeArgumentQualifier<T> extends TypeArgumentQualifier<T>
A Qualifier that qualifies beans by generic type arguments and only returns the candidates that most closely match.
Since:
1.1.1
Author:
James Kleeh
  • Method Details

    • reduce

      public <BT extends BeanType<T>> Stream<BT> reduce(Class<T> beanType, Stream<BT> candidates)
      Specified by:
      reduce in interface Qualifier<T>
      Overrides:
      reduce in class TypeArgumentQualifier<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
    • compare

      protected int compare(List<Class<?>> classesToCompare)
      Parameters:
      classesToCompare - An array of classes
      Returns:
      Whether the types are compatible