Module io.helidon.inject.testing
Package io.helidon.inject.testing
Class ReflectionBasedSingletonServiceProvider<T>
java.lang.Object
io.helidon.inject.runtime.AbstractServiceProvider<T>
io.helidon.inject.testing.ReflectionBasedSingletonServiceProvider<T>
- Type Parameters:
T
- the service type
- All Implemented Interfaces:
Weighted
,ActivationPhaseReceiver
,Activator
,DeActivator
,InjectionPointProvider<T>
,Resettable
,ServiceProvider<T>
,ServiceProviderBindable<T>
,Provider<T>
,Comparable<Weighted>
Creates a simple reflection based service provider - for testing purposes only!
-
Nested Class Summary
Nested classes/interfaces inherited from class io.helidon.inject.runtime.AbstractServiceProvider
AbstractServiceProvider.LogEntryAndResult
-
Field Summary
Fields inherited from interface io.helidon.common.Weighted
DEFAULT_WEIGHT
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ReflectionBasedSingletonServiceProvider
<T> Generates a service provider eligible for binding into the service registry with the following proviso: The service type will be ofjakarta.inject.Singleton
scope The service type will be created reflectively, and will expect to have an empty constructor The service type will not be able to provide its dependencies, nor will it be able to accept injection The service type will not be able to participate in lifecycle -PostConstructMethod
orPreDestroyMethod
Note: Generally it is encouraged for users to rely on the annotation processors and other built on compile-time tooling to generate the appropriate service providers and modules.protected T
createServiceProvider
(Map<String, Object> deps) Creates the service with the supplied resolved dependencies, key'ed by each injection point id.boolean
isCustom()
Identifies whether the implementation was custom written and not code generated.The type of the service being managed.Methods inherited from class io.helidon.inject.runtime.AbstractServiceProvider
activate, activationLog, activator, createLogEntryAndResult, currentActivationPhase, deactivate, deActivator, dependencies, dependencies, description, doConstructing, doDestroying, doInjectingFields, doInjectingMethods, doPostConstructing, doPreDestroying, equals, expectedQualifiedServiceError, first, get, get, getOrCreateInjectionPlan, hashCode, id, identityPrefix, identitySuffix, injectionPlanBinder, injectionServices, injectionServices, interceptor, interceptor, isAlreadyAtTargetPhase, isInterceptor, isProvider, list, logger, maybeActivate, moduleName, name, onFailedFinish, onFinalShutdown, onFinished, onPhaseEvent, postConstructMethod, preDestroyMethod, reset, serviceInfo, serviceInfo, serviceProviderBindable, serviceRef, serviceTypeInjectionOrder, startTransitionCurrentActivationPhase, toAbstractServiceProvider, toString, weight
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.helidon.inject.api.ServiceProviderBindable
isIntercepted, isRootProvider, rootProvider, rootProvider
-
Method Details
-
create
public static <T> ReflectionBasedSingletonServiceProvider<T> create(Class<T> serviceType, io.helidon.inject.api.ServiceInfoBasics siBasics) Generates a service provider eligible for binding into the service registry with the following proviso:- The service type will be of
jakarta.inject.Singleton
scope - The service type will be created reflectively, and will expect to have an empty constructor
- The service type will not be able to provide its dependencies, nor will it be able to accept injection
- The service type will not be able to participate in lifecycle -
PostConstructMethod
orPreDestroyMethod
- Type Parameters:
T
- the class of the service type- Parameters:
serviceType
- the service typesiBasics
- the service info basic descriptor, or null to generate a default (empty) placeholder- Returns:
- the service provider capable of being bound to the services registry
- See Also:
- The service type will be of
-
isCustom
public boolean isCustom()Description copied from class:AbstractServiceProvider
Identifies whether the implementation was custom written and not code generated. We assume by default this is part of code-generation, and the default is to return false.- Overrides:
isCustom
in classAbstractServiceProvider<T>
- Returns:
- true if a custom, user-supplied implementation (rare)
-
createServiceProvider
Description copied from class:AbstractServiceProvider
Creates the service with the supplied resolved dependencies, key'ed by each injection point id.- Overrides:
createServiceProvider
in classAbstractServiceProvider<T>
- Parameters:
deps
- the resolved dependencies- Returns:
- the newly created managed service
-
serviceType
Description copied from interface:ServiceProvider
The type of the service being managed.- Returns:
- the service type being managed
-