Interface ServiceInstance<T>

Type Parameters:
T - type of the instance
All Superinterfaces:
Service.QualifiedInstance<T>, Supplier<T>

public interface ServiceInstance<T> extends Service.QualifiedInstance<T>
An instance managed by the service registry, with a subset of relevant metadata. This type is injectable in the same manner as a regular service instance.
  • Field Details

    • TYPE

      static final TypeName TYPE
      Type name of this interface. TypeName is used in various APIs of service registry.
  • Method Details

    • contracts

      Set<ResolvedType> contracts()
      Contracts of the service instance.
      Returns:
      contracts the service instance implements
    • scope

      TypeName scope()
      Scope this instance was created in. Always the same as the scope of the associated service descriptor (ServiceDescriptor.scope(). This method may return Service.PerLookup in case no scope is defined ("Dependent" scope is not a real scope, as the instances cannot be managed, so each time an instance is injected, it is constructed, injected, post constructed, and then forgotten by the registry).
      Returns:
      scope of this service instance
    • weight

      double weight()
      Weight of this instance, inherited from Weighted.weight().
      Returns:
      weight
    • serviceType

      TypeName serviceType()
      Service type responsible for creating this value, inherited from ServiceInfo.serviceType().
      Returns:
      service type