Module io.helidon.service.registry
Package io.helidon.service.registry
Interface Service.QualifiedFactory<T,A extends Annotation>
- Type Parameters:
T
- type of the provided instance, the special case isObject
- if used, we consider this factory to be capable of handling ANY type, and will allow injection points with any type as long as it is qualified by the qualifierA
- type of qualifier supported by this factory
- All Known Implementing Classes:
GeneratedService.QualifiedFactoryInterceptionWrapper
- Enclosing class:
Service
public static interface Service.QualifiedFactory<T,A extends Annotation>
A factory to resolve qualified injection points of any type.
As compared to Service.InjectionPointFactory
, this type is capable of resolving ANY injection
point as long as it is annotated by the qualifier. The contract of the injection point depends on how the implementation
service declares the type parameters of this interface. If you use any type other than Object
, that will
be the only supported contract, otherwise any type is expected to be supported.
A good practice is to create an accompanying codegen extension that validates injection points at build time.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionfirst
(Qualifier qualifier, Lookup lookup, GenericType<T> type) Get the first instance (if any) matching the qualifier and type.default List
<Service.QualifiedInstance<T>> list
(Qualifier qualifier, Lookup lookup, GenericType<T> type) Get all instances matching the qualifier and type.
-
Field Details
-
TYPE
Type name of this interface.
-
-
Method Details
-
first
Optional<Service.QualifiedInstance<T>> first(Qualifier qualifier, Lookup lookup, GenericType<T> type) Get the first instance (if any) matching the qualifier and type.- Parameters:
qualifier
- the qualifier this type supports (same type as theA
type this type implements)lookup
- full lookup used to obtain the value, may contain the actual injection pointtype
- type to be injected (or type requested)- Returns:
- the qualified instance matching the request, or an empty optional if none match
-
list
default List<Service.QualifiedInstance<T>> list(Qualifier qualifier, Lookup lookup, GenericType<T> type) Get all instances matching the qualifier and type.- Parameters:
qualifier
- the qualifier this type supports (same type as theA
type this type implements)lookup
- full lookup used to obtain the value, may contain the actual injection pointtype
- type to be injected (or type requested)- Returns:
- the qualified instance matching the request, or an empty optional if none match
-