T - The type of instance to providepublic class DeferredInstanceProvider<T> extends Object implements InstanceProvider<T>
InstanceProvider implementation that defers resolving an instance until get(), hasMultiple(), isUnsatisfied(), or iterator() is invoked| Modifier and Type | Method and Description |
|---|---|
static <T> DeferredInstanceProvider<T> |
from(TypeQualifier<T> service, InstanceLocator locator)
Instantiate a
DeferredInstanceProvider |
T |
get()
Retrieve the first available instance
|
boolean |
hasMultiple()
Determines if there is more than one available implementation for the required type and qualifiers
|
boolean |
isUnsatisfied()
Determines if there is no available implementation for the required type and qualifiers.
|
Iterator<T> |
iterator()
When a service has multiple providers (which can be determined by calling
InstanceProvider.isAmbiguous()) this iterator enumerates each of the available providers |
TypeQualifier<T> |
qualifier()
Identifies the constraints used to select matches
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetOrNull, isAmbiguous, isAvailable, isUnavailable, orElse, streamforEach, spliteratorpublic T get()
InstanceProviderpublic boolean hasMultiple()
InstanceProviderhasMultiple in interface InstanceProvider<T>public boolean isUnsatisfied()
InstanceProviderInstanceProvider.get() will raise a RuntimeExceptionisUnsatisfied in interface InstanceProvider<T>public Iterator<T> iterator()
InstanceProviderInstanceProvider.isAmbiguous()) this iterator enumerates each of the available providerspublic TypeQualifier<T> qualifier()
InstanceProviderqualifier in interface InstanceProvider<T>TypeQualifier instancepublic static <T> DeferredInstanceProvider<T> from(TypeQualifier<T> service, InstanceLocator locator)
DeferredInstanceProviderT - The type of instance to provideservice - The service that needs to be providedlocator - The locator that can provide the service.DeferredInstanceProvider