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>

public class ReflectionBasedSingletonServiceProvider<T> extends AbstractServiceProvider<T>
Creates a simple reflection based service provider - for testing purposes only!
  • 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 or PreDestroyMethod
      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. This method is an alternative to that mechanism and therefore is discouraged from production use. This method is not used in normal processing by the reference injection provider implementation.
      Type Parameters:
      T - the class of the service type
      Parameters:
      serviceType - the service type
      siBasics - 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:
    • 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 class AbstractServiceProvider<T>
      Returns:
      true if a custom, user-supplied implementation (rare)
    • createServiceProvider

      protected T createServiceProvider(Map<String,Object> deps)
      Description copied from class: AbstractServiceProvider
      Creates the service with the supplied resolved dependencies, key'ed by each injection point id.
      Overrides:
      createServiceProvider in class AbstractServiceProvider<T>
      Parameters:
      deps - the resolved dependencies
      Returns:
      the newly created managed service
    • serviceType

      public Class<T> serviceType()
      Description copied from interface: ServiceProvider
      The type of the service being managed.
      Returns:
      the service type being managed