- Type Parameters:
T
- the type that the provider produces
- All Superinterfaces:
Provider<T>
- All Known Subinterfaces:
ConfiguredServiceProvider<T,
,CB> ServiceProvider<T>
,ServiceProviderBindable<T>
- All Known Implementing Classes:
AbstractServiceProvider
,ConfigDrivenServiceProviderBase
,ReflectionBasedSingletonServiceProvider
Provides ability to contextualize the injected service by the target receiver of the injection point dynamically
at runtime. This API will provide service instances of type
T
. These services may be singleton, or created based upon
scoping cardinality that is defined by the provider implementation of the given type. This is why the javadoc reads "get (or
create)".
The ordering of services, and the preferred service itself, is determined by the same as documented for
Services
.
-
Method Summary
Modifier and TypeMethodDescriptionfirst
(io.helidon.inject.api.ContextualServiceQuery query) Get (or create) an instance of this service type for the given injection point context.default T
get()
Get (or create) an instance of this service type using default/empty criteria and context.list
(io.helidon.inject.api.ContextualServiceQuery query) Get (or create) a list of instances matching the criteria for the given injection point context.
-
Method Details
-
get
Get (or create) an instance of this service type using default/empty criteria and context.- Specified by:
get
in interfaceProvider<T>
- Returns:
- the best service provider matching the criteria
- Throws:
InjectionException
- if resolution fails to resolve a match
-
first
Get (or create) an instance of this service type for the given injection point context. This is logically the same as using the first element of the result from callinglist(ContextualServiceQuery)
.- Parameters:
query
- the service query- Returns:
- the best service provider matching the criteria
- Throws:
InjectionException
- if expected=true and resolution fails to resolve a match
-
list
Get (or create) a list of instances matching the criteria for the given injection point context.- Parameters:
query
- the service query- Returns:
- the resolved services matching criteria for the injection point in order of weight, or null if the context is not supported
-