Interface Service.QualifiedInstance<T>

Type Parameters:
T - type of instance, as provided by the service
All Superinterfaces:
Supplier<T>
All Known Subinterfaces:
ServiceInstance<T>
Enclosing class:
Service

public static interface Service.QualifiedInstance<T> extends Supplier<T>
An instance with its qualifiers. Some services are allowed to create more than one instance, and there may be a need to use different qualifiers than the factory service uses.
See Also:
  • Method Details

    • create

      static <T> Service.QualifiedInstance<T> create(T instance, Qualifier... qualifiers)
      Create a new qualified instance.
      Type Parameters:
      T - type of the instance
      Parameters:
      instance - the instance
      qualifiers - qualifiers to use
      Returns:
      a new qualified instance
    • create

      static <T> Service.QualifiedInstance<T> create(T instance, Set<Qualifier> qualifiers)
      Create a new qualified instance.
      Type Parameters:
      T - type of the instance
      Parameters:
      instance - the instance
      qualifiers - qualifiers to use
      Returns:
      a new qualified instance
    • get

      T get()
      Get the instance that the registry manages (or an instance that is unmanaged, if the provider is in Service.PerLookup, or if the instance is created by a factory). The instance must be guaranteed to be constructed and if managed by the registry, and activation scope is not limited, then injected as well.
      Specified by:
      get in interface Supplier<T>
      Returns:
      instance
    • qualifiers

      Set<Qualifier> qualifiers()
      Qualifiers of the instance.
      Returns:
      qualifiers of the service instance