Interface ServiceProvider<T>

Type Parameters:
T - the type that this service provider manages
All Superinterfaces:
Comparable<Weighted>, InjectionPointProvider<T>, Provider<T>, Weighted
All Known Subinterfaces:
ConfiguredServiceProvider<T,CB>, ServiceProviderBindable<T>
All Known Implementing Classes:
AbstractServiceProvider, ConfigDrivenServiceProviderBase, ReflectionBasedSingletonServiceProvider

public interface ServiceProvider<T> extends InjectionPointProvider<T>, Weighted
Provides management lifecycle around services.
  • Method Details

    • id

      String id()
      Identifies the service provider physically and uniquely.
      Returns:
      the unique identity of the service provider
    • description

      String description()
      Describe the service provider. This will change based upon activation state.
      Returns:
      the logical and immutable description
    • isProvider

      boolean isProvider()
      Does the service provide singletons, does it always produce the same result for every call to InjectionPointProvider.get(). I.e., if the managed service implements Provider or InjectionPointProvider then this typically is considered not a singleton provider. I.e., If the managed services is NOT Singleton, then it will be treated as per request / dependent scope. Note that this is similar in nature to RequestScope, except the "official" request scope is bound to the web request. Here, we are speaking about contextually any caller asking for a new instance of the service in question. The requester in question will ideally be able to identify itself to this provider via InjectionPointProvider.first(ContextualServiceQuery) so that this provider can properly service the "provide" request.
      Returns:
      true if the service provider provides per-request instances for each caller
    • serviceInfo

      io.helidon.inject.api.ServiceInfo serviceInfo()
      The meta information that describes the service. Must remain immutable for the lifetime of the JVM post binding - ie., after ServiceBinder.bind(ServiceProvider) is called.
      Returns:
      the meta information describing the service
    • dependencies

      io.helidon.inject.api.DependenciesInfo dependencies()
      Provides the dependencies for this service provider if known, or null if not known or not available.
      Returns:
      the dependencies this service provider has or null if unknown or unavailable
    • currentActivationPhase

      Phase currentActivationPhase()
      The current activation phase for this service provider.
      Returns:
      the activation phase
    • activator

      Optional<Activator> activator()
      The agent responsible for activation - this will be non-null for build-time activators. If not present then an Injector must be used to reflectively activate.
      Returns:
      the activator
    • deActivator

      Optional<DeActivator> deActivator()
      The agent responsible for deactivation - this will be non-null for build-time activators. If not present then an Injector must be used to reflectively deactivate.
      Returns:
      the deactivator to use or null if the service is not interested in deactivation
    • postConstructMethod

      Optional<PostConstructMethod> postConstructMethod()
      The optional method handling PreDestroy.
      Returns:
      the post-construct method or empty if there is none
    • preDestroyMethod

      Optional<PreDestroyMethod> preDestroyMethod()
      The optional method handling PostConstruct.
      Returns:
      the pre-destroy method or empty if there is none
    • serviceProviderBindable

      Optional<ServiceProviderBindable<T>> serviceProviderBindable()
      The agent/instance to be used for binding this service provider to the injectable application that was code generated.
      Returns:
      the service provider that should be used for binding, or empty if this provider does not support binding
      See Also:
    • serviceType

      Class<?> serviceType()
      The type of the service being managed.
      Returns:
      the service type being managed