public class Qualifiers
extends java.lang.Object
Bean qualifiers.| Constructor and Description |
|---|
Qualifiers() |
| Modifier and Type | Method and Description |
|---|---|
static <T> Qualifier<T> |
any()
Allows looking up the first matching instance.
|
static <T> Qualifier<T> |
byAnnotation(java.lang.annotation.Annotation annotation)
Build a qualifier for the given annotation.
|
static <T> Qualifier<T> |
byAnnotation(io.micronaut.core.annotation.AnnotationMetadata metadata,
java.lang.Class<? extends java.lang.annotation.Annotation> type)
Build a qualifier for the given annotation.
|
static <T> Qualifier<T> |
byAnnotation(io.micronaut.core.annotation.AnnotationMetadata metadata,
java.lang.String type)
Build a qualifier for the given annotation.
|
static <T> Qualifier<T> |
byAnnotationSimple(io.micronaut.core.annotation.AnnotationMetadata metadata,
java.lang.String type)
Build a qualifier for the given annotation.
|
static <T> Qualifier<T> |
byExactTypeArgumentName(java.lang.String typeName)
Build a qualifier for the given generic type argument name.
|
static <T> Qualifier<T> |
byInterceptorBinding(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
Reduces bean definitions by the given interceptor binding.
|
static <T> Qualifier<T> |
byInterceptorBinding(java.util.Collection<java.lang.String> bindingAnnotationNames)
Deprecated.
|
static <T> Qualifier<T> |
byInterceptorBindingValues(java.util.Collection<io.micronaut.core.annotation.AnnotationValue<?>> binding)
Reduces bean definitions by the given interceptor binding.
|
static <T> Qualifier<T> |
byName(java.lang.String name)
Build a qualifier for the given name.
|
static <T> Qualifier<T> |
byQualifiers(Qualifier<T>... qualifiers)
Build a qualifier from other qualifiers.
|
static <T> Qualifier<T> |
byRepeatableAnnotation(io.micronaut.core.annotation.AnnotationMetadata metadata,
java.lang.String repeatableType)
Builds a qualifier that uses the given repeatable annotation.
|
static <T> Qualifier<T> |
byStereotype(java.lang.Class<? extends java.lang.annotation.Annotation> stereotype)
Build a qualifier for the given annotation.
|
static <T> Qualifier<T> |
byStereotype(java.lang.String stereotype)
Build a qualifier for the given annotation.
|
static <T> Qualifier<T> |
byType(java.lang.Class... typeArguments)
Build a qualifier for the given generic type arguments.
|
static <T> Qualifier<T> |
byTypeArguments(java.lang.Class... typeArguments)
Build a qualifier for the given generic type arguments.
|
static <T> Qualifier<T> |
byTypeArgumentsClosest(java.lang.Class... typeArguments)
Build a qualifier for the given generic type arguments.
|
static <T> Qualifier<T> |
forArgument(io.micronaut.core.type.Argument<?> argument)
Build a qualifier for the given argument.
|
public static <T> Qualifier<T> any()
This qualifier results on NonUniqueBeanException never being thrown as
the first matching instance will be returned.
T - The generic typeAny@Nullable public static <T> Qualifier<T> forArgument(@NonNull io.micronaut.core.type.Argument<?> argument)
T - The typeargument - The argumentpublic static <T> Qualifier<T> byQualifiers(Qualifier<T>... qualifiers)
T - The component typequalifiers - The qualifierspublic static <T> Qualifier<T> byName(java.lang.String name)
T - The component typename - The namepublic static <T> Qualifier<T> byAnnotation(java.lang.annotation.Annotation annotation)
T - The component typeannotation - The annotationpublic static <T> Qualifier<T> byAnnotation(io.micronaut.core.annotation.AnnotationMetadata metadata, java.lang.Class<? extends java.lang.annotation.Annotation> type)
T - The component typemetadata - The metadatatype - The annotation typepublic static <T> Qualifier<T> byAnnotation(io.micronaut.core.annotation.AnnotationMetadata metadata, java.lang.String type)
Build a qualifier for the given annotation. This qualifier will match a candidate under the following circumstances:
T - The component typemetadata - The metadatatype - The annotation typepublic static <T> Qualifier<T> byRepeatableAnnotation(io.micronaut.core.annotation.AnnotationMetadata metadata, java.lang.String repeatableType)
Builds a qualifier that uses the given repeatable annotation.
T - The component typemetadata - The metadatarepeatableType - The annotation repeatable type. That is the annotation specified to Repeatable.value()@Internal public static <T> Qualifier<T> byAnnotationSimple(io.micronaut.core.annotation.AnnotationMetadata metadata, java.lang.String type)
Build a qualifier for the given annotation.
Unlike byAnnotation(io.micronaut.core.annotation.AnnotationMetadata, String) this method will not attempt to pick the qualifier strategy to use at runtime based on the passed annotation name.
T - The component typemetadata - The metadatatype - The annotation typepublic static <T> Qualifier<T> byStereotype(java.lang.Class<? extends java.lang.annotation.Annotation> stereotype)
T - The component typestereotype - The stereotypepublic static <T> Qualifier<T> byStereotype(java.lang.String stereotype)
T - The component typestereotype - The stereotypepublic static <T> Qualifier<T> byTypeArguments(java.lang.Class... typeArguments)
T - The component typetypeArguments - The generic type arguments@NonNull public static <T> Qualifier<T> byExactTypeArgumentName(@NonNull java.lang.String typeName)
T - The component typetypeName - The name of the generic type argumentpublic static <T> Qualifier<T> byTypeArgumentsClosest(java.lang.Class... typeArguments)
T - The component typetypeArguments - The generic type argumentspublic static <T> Qualifier<T> byType(java.lang.Class... typeArguments)
T - The component typetypeArguments - The generic type arguments@NonNull public static <T> Qualifier<T> byInterceptorBinding(@NonNull io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
T - The bean typeannotationMetadata - The annotation metadata@Deprecated @NonNull public static <T> Qualifier<T> byInterceptorBinding(@NonNull java.util.Collection<java.lang.String> bindingAnnotationNames)
byInterceptorBindingValues(java.util.Collection)T - The bean typebindingAnnotationNames - The binding annotation names@NonNull public static <T> Qualifier<T> byInterceptorBindingValues(@NonNull java.util.Collection<io.micronaut.core.annotation.AnnotationValue<?>> binding)
T - The bean typebinding - The binding values to use