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(Annotation annotation)
Build a qualifier for the given annotation.
|
static <T> Qualifier<T> |
byAnnotation(AnnotationMetadata metadata,
Class<? extends Annotation> type)
Build a qualifier for the given annotation.
|
static <T> Qualifier<T> |
byAnnotation(AnnotationMetadata metadata,
String type)
Build a qualifier for the given annotation.
|
static <T> Qualifier<T> |
byAnnotationSimple(AnnotationMetadata metadata,
String type)
Build a qualifier for the given annotation.
|
static <T> Qualifier<T> |
byExactTypeArgumentName(String typeName)
Build a qualifier for the given generic type argument name.
|
static <T> Qualifier<T> |
byInterceptorBinding(AnnotationMetadata annotationMetadata)
Reduces bean definitions by the given interceptor binding.
|
static <T> Qualifier<T> |
byInterceptorBinding(Collection<String> bindingAnnotationNames)
Deprecated.
|
static <T> Qualifier<T> |
byInterceptorBindingValues(Collection<AnnotationValue<?>> binding)
Reduces bean definitions by the given interceptor binding.
|
static <T> Qualifier<T> |
byName(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(AnnotationMetadata metadata,
String repeatableType)
Builds a qualifier that uses the given repeatable annotation.
|
static <T> Qualifier<T> |
byStereotype(Class<? extends Annotation> stereotype)
Build a qualifier for the given annotation.
|
static <T> Qualifier<T> |
byStereotype(String stereotype)
Build a qualifier for the given annotation.
|
static <T> Qualifier<T> |
byType(Class... typeArguments)
Build a qualifier for the given generic type arguments.
|
static <T> Qualifier<T> |
byTypeArguments(Class... typeArguments)
Build a qualifier for the given generic type arguments.
|
static <T> Qualifier<T> |
byTypeArgumentsClosest(Class... typeArguments)
Build a qualifier for the given generic type arguments.
|
static <T> Qualifier<T> |
forArgument(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 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(String name)
T
- The component typename
- The namepublic static <T> Qualifier<T> byAnnotation(Annotation annotation)
T
- The component typeannotation
- The annotationpublic static <T> Qualifier<T> byAnnotation(AnnotationMetadata metadata, Class<? extends Annotation> type)
T
- The component typemetadata
- The metadatatype
- The annotation typepublic static <T> Qualifier<T> byAnnotation(AnnotationMetadata metadata, 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(AnnotationMetadata metadata, 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(AnnotationMetadata metadata, 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(Class<? extends Annotation> stereotype)
T
- The component typestereotype
- The stereotypepublic static <T> Qualifier<T> byStereotype(String stereotype)
T
- The component typestereotype
- The stereotypepublic static <T> Qualifier<T> byTypeArguments(Class... typeArguments)
T
- The component typetypeArguments
- The generic type arguments@NonNull public static <T> Qualifier<T> byExactTypeArgumentName(@NonNull String typeName)
T
- The component typetypeName
- The name of the generic type argumentpublic static <T> Qualifier<T> byTypeArgumentsClosest(Class... typeArguments)
T
- The component typetypeArguments
- The generic type argumentspublic static <T> Qualifier<T> byType(Class... typeArguments)
T
- The component typetypeArguments
- The generic type arguments@NonNull public static <T> Qualifier<T> byInterceptorBinding(@NonNull AnnotationMetadata annotationMetadata)
T
- The bean typeannotationMetadata
- The annotation metadata@Deprecated @NonNull public static <T> Qualifier<T> byInterceptorBinding(@NonNull Collection<String> bindingAnnotationNames)
byInterceptorBindingValues(java.util.Collection)
T
- The bean typebindingAnnotationNames
- The binding annotation names@NonNull public static <T> Qualifier<T> byInterceptorBindingValues(@NonNull Collection<AnnotationValue<?>> binding)
T
- The bean typebinding
- The binding values to use