Interface InjectionPointProvider<T>

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

public interface InjectionPointProvider<T> extends Provider<T>
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 Type
    Method
    Description
    first(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.
    default List<T>
    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

      default T get()
      Get (or create) an instance of this service type using default/empty criteria and context.
      Specified by:
      get in interface Provider<T>
      Returns:
      the best service provider matching the criteria
      Throws:
      InjectionException - if resolution fails to resolve a match
    • first

      Optional<T> first(io.helidon.inject.api.ContextualServiceQuery query)
      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 calling list(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

      default List<T> list(io.helidon.inject.api.ContextualServiceQuery query)
      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