Class InterceptorBindingQualifier<T>

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

@Internal public final class InterceptorBindingQualifier<T> extends FilteringQualifier<T>
Qualifies interceptor beans by the io.micronaut.aop.InterceptorBinding annotations of an interception point.

A binding names the binding annotation and, when it binds members, the members are compared on the occurrences of the binding annotation found on each side, see resolveBoundOccurrences(AnnotationValue, AnnotationMetadata). An interceptor bound by name only applies wherever its binding annotation does.

Since:
3.0.0
Author:
graemerocher
  • Field Details

    • META_BINDING_VALUES

      public static final String META_BINDING_VALUES
      The member of a binding written by earlier versions of the framework, carrying a copy of the occurrence of the binding annotation the binding was declared through. Members are now compared on the occurrences themselves, which a binding annotation retains, and the copy is only read where it is still present.
      See Also:
    • META_MEMBER_INTERCEPTOR_TYPE

      public static final String META_MEMBER_INTERCEPTOR_TYPE
      See Also:
  • Method Details

    • doesQualify

      public boolean doesQualify(Class<T> beanType, BeanType<T> candidate)
      Description copied from interface: Qualifier
      Check if the candidate qualifies.
      Parameters:
      beanType - The bean type
      candidate - The candidate
      Returns:
      true if matches
    • resolveBoundOccurrences

      @Internal public static @Nullable List<AnnotationValue<?>> resolveBoundOccurrences(AnnotationValue<?> binding, @Nullable AnnotationMetadata annotationMetadata)
      The occurrences of the binding annotation a binding compares members with, in the given metadata.

      null when the binding does not bind members, or when the metadata holds no occurrence of the binding annotation: such a binding matches by name. Otherwise the occurrences of the binding annotation, declared on the element or composed by another annotation and retained on it, with the members marked io.micronaut.context.annotation.NonBinding left out. A binding written by an earlier version of the framework carries a copy of its occurrence, which is used as is.

      Parameters:
      binding - The interceptor binding
      annotationMetadata - The metadata of the element the binding was declared on
      Returns:
      The occurrences to compare, or null to compare by name
      Since:
      5.2.0
    • resolveBoundOccurrences

      @Internal public static @Nullable List<AnnotationValue<?>> resolveBoundOccurrences(AnnotationValue<?> binding, @Nullable AnnotationMetadata annotationMetadata, boolean declaredOverrides)
      The occurrences of the binding annotation a binding compares members with, in the given metadata.
      Parameters:
      binding - The interceptor binding
      annotationMetadata - The metadata of the element the binding was declared on
      declaredOverrides - Whether, for a hierarchy such as a method under its class, an occurrence declared on the most specific element replaces the ones above it, the way the bindings themselves are resolved for an interception point
      Returns:
      The occurrences to compare, or null to compare by name
      Since:
      5.2.0
      See Also:
    • anyMatch

      @Internal public static boolean anyMatch(Collection<AnnotationValue<?>> occurrences, Collection<AnnotationValue<?>> otherOccurrences)
      Whether any occurrence of one side is the same annotation as any occurrence of the other, every member compared with the defaults filled in.
      Parameters:
      occurrences - The occurrences of one side
      otherOccurrences - The occurrences of the other side
      Returns:
      Whether one pair matches
      Since:
      5.2.0
    • bindingValuesMatch

      @Internal public static boolean bindingValuesMatch(@Nullable AnnotationValue<?> interceptorValues, @Nullable AnnotationValue<?> interceptPointValues)
      Whether two binding occurrences are the same annotation.
      Parameters:
      interceptorValues - The occurrence bound on the interceptor
      interceptPointValues - The occurrence at the interception point
      Returns:
      Whether the two are the same annotation, or there is nothing bound on the interceptor
    • 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