Interface ServiceInstance<T>
- Type Parameters:
T- type of the instance
- All Superinterfaces:
Service.QualifiedInstance<T>, Supplier<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 Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionContracts associated with this service instance for the lookup that produced it.scope()Scope this instance was created in.Service type responsible for creating this value, inherited fromServiceInfo.serviceType().doubleweight()Weight of this instance, inherited fromWeighted.weight().Methods inherited from interface Service.QualifiedInstance
get, qualifiersModifier and TypeMethodDescriptionget()Get the instance that the registry manages (or an instance that is unmanaged, if the provider is inService.PerLookup, or if the instance is created by a factory).Qualifiers of the instance.
-
Field Details
-
TYPE
-
-
Method Details
-
contracts
Set<ResolvedType> contracts()Contracts associated with this service instance for the lookup that produced it. For factory-backed services, provided-service lookups return the provided service contracts, while provider-targeted lookups return the provider or factory contracts.- Returns:
- contracts associated with this service instance for the current lookup
-
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 returnService.PerLookupin 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
-
serviceType
TypeName serviceType()Service type responsible for creating this value, inherited fromServiceInfo.serviceType().- Returns:
- service type
-