public interface Injector
Used to perform programmatic activation and injection.
Note that the reference implementation of Injection only performs non-reflective, compile-time generation of service activators for services that it manages. This Injector contract is mainly provided in order to allow other library extension implementations to extend the model to perform other types of injection point resolution.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
The strategy the injector should attempt to apply. -
Method Summary
Modifier and TypeMethodDescription<T> io.helidon.inject.api.ActivationResult
activateInject
(T serviceOrServiceProvider, io.helidon.inject.api.InjectorOptions opts) Called to activate and inject a manage service instance or service provider, putting it intoPhase.ACTIVE
.<T> io.helidon.inject.api.ActivationResult
deactivate
(T serviceOrServiceProvider, io.helidon.inject.api.InjectorOptions opts) Called to deactivate a managed service or service provider, putting it intoPhase.DESTROYED
.
-
Method Details
-
activateInject
<T> io.helidon.inject.api.ActivationResult activateInject(T serviceOrServiceProvider, io.helidon.inject.api.InjectorOptions opts) throws InjectionServiceProviderException Called to activate and inject a manage service instance or service provider, putting it intoPhase.ACTIVE
.- Type Parameters:
T
- the managed service type- Parameters:
serviceOrServiceProvider
- the target instance or service provider being activated and injectedopts
- the injector options- Returns:
- the result of the activation
- Throws:
InjectionServiceProviderException
- if an injection or activation problem occurs- See Also:
-
deactivate
<T> io.helidon.inject.api.ActivationResult deactivate(T serviceOrServiceProvider, io.helidon.inject.api.InjectorOptions opts) throws InjectionServiceProviderException Called to deactivate a managed service or service provider, putting it intoPhase.DESTROYED
. If a managed service has aPreDestroy
annotated method then it will be called during this lifecycle event.- Type Parameters:
T
- the managed service type- Parameters:
serviceOrServiceProvider
- the service provider or instance registered and being managedopts
- the injector options- Returns:
- the result of the deactivation
- Throws:
InjectionServiceProviderException
- if a problem occurs- See Also:
-