Class TypeArgumentQualifier<T>

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

@Internal public class TypeArgumentQualifier<T> extends Object implements Qualifier<T>
A Qualifier that qualifies beans by generic type arguments.
Since:
1.0
Author:
Graeme Rocher
  • Method Details

    • 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
    • getTypeArguments

      public Class<?>[] getTypeArguments()
      Returns:
      The type arguments
    • areTypesCompatible

      protected boolean areTypesCompatible(List<Class<?>> classes)
      Parameters:
      classes - An array of classes
      Returns:
      Whether the types are compatible
    • getTypeArguments

      protected <BT extends BeanType<T>> List<Class<?>> getTypeArguments(Class<T> beanType, BT candidate)
      Type Parameters:
      BT - The bean type subclass
      Parameters:
      beanType - The bean type
      candidate - The candidate
      Returns:
      The list of type arguments
    • areTypesCompatible

      public static boolean areTypesCompatible(Class<?>[] typeArguments, List<Class<?>> classes)
      Are the given types compatible.
      Parameters:
      typeArguments - The type arguments
      classes - The classes to check for alignments
      Returns:
      True if they are
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object