Package io.micronaut.context
Interface Qualifier<T>
- Type Parameters:
T
- The qualifier type
- All Known Implementing Classes:
AnyQualifier
,ClosestTypeArgumentQualifier
,ConsumesMediaTypeQualifier
,InterceptorBindingQualifier
,PrimaryQualifier
,ProducesMediaTypeQualifier
,TypeAnnotationQualifier
,TypeArgumentQualifier
public interface Qualifier<T>
Used to qualify which bean to select in the case of multiple possible options.
NOTE: When implementing a custom Qualifier you MUST implement Object.hashCode()
and
Object.equals(Object)
so that the qualifier can be used in comparisons and equality checks
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
Whether this qualifier contains the given qualifier.Qualify the candidate from the stream of candidates.
-
Field Details
-
PRIMARY
The name of the primary annotation class.
-
-
Method Details
-
reduce
- Type Parameters:
BT
- The bean type subclass- Parameters:
beanType
- The bean typecandidates
- The candidates- Returns:
- The qualified candidate or null it cannot be qualified
-
contains
Whether this qualifier contains the given qualifier.- Parameters:
qualifier
- The qualifier- Returns:
- True it does
-
qualify
Qualify the candidate from the stream of candidates.- Type Parameters:
BT
- The bean type subclass- Parameters:
beanType
- The bean typecandidates
- The candidates- Returns:
- The qualified candidate or
Optional.empty()
-