T - The type of the instancespublic class ResolvedInstances<T> extends Object implements InstanceProvider<T>
InstanceLocator.select(TypeQualifier)| Modifier and Type | Method and Description |
|---|---|
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 |
static <T> ResolvedInstances<T> |
matches(InstanceProvider<T> firstMatch, InstanceProvider<T>... subsequentMatches)
Concatenates a series of matches together
|
static <T> ResolvedInstances<T> |
matches(TypeQualifier<T> qualifier, Collection<Throwable> errors, Iterable<T> matches)
Produce a
ResolvedInstances using the specified TypeQualifier and set of instances |
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 instance@SafeVarargs public static <T> ResolvedInstances<T> matches(InstanceProvider<T> firstMatch, InstanceProvider<T>... subsequentMatches)
T - The type of the instancesfirstMatch - The first set of matchessubsequentMatches - The remainder of the matchesResolvedInstances instancepublic static <T> ResolvedInstances<T> matches(TypeQualifier<T> qualifier, Collection<Throwable> errors, Iterable<T> matches)
ResolvedInstances using the specified TypeQualifier and set of instancesT - The type of the instanceserrors - Any errors encountered in resolving the instancesqualifier - The constraints used to match the instancesmatches - The matchesResolvedInstances instance