Package oracle.dbtools.plugin.api.di
Class ResolvedInstances<T>
java.lang.Object
oracle.dbtools.plugin.api.di.ResolvedInstances<T>
- Type Parameters:
T- The type of the instances
- All Implemented Interfaces:
jakarta.inject.Provider<T>,Iterable<T>,Supplier<T>,InstanceProvider<T>
Represents the discovered matches for a call to
InstanceLocator.select(TypeQualifier)- Since:
- 19.3.0
- Author:
- cdivilly
-
Method Summary
Modifier and TypeMethodDescriptionget()Retrieve the first available instancebooleanDetermines if there is more than one available implementation for the required type and qualifiersbooleanDetermines if there is no available implementation for the required type and qualifiers.iterator()When a service has multiple providers (which can be determined by callingInstanceProvider.isAmbiguous()) this iterator enumerates each of the available providersstatic <T> ResolvedInstances<T>matches(InstanceProvider<T> firstMatch, InstanceProvider<T>... subsequentMatches) Concatenates a series of matches togetherstatic <T> ResolvedInstances<T>matches(TypeQualifier<T> qualifier, Collection<Throwable> errors, Iterable<T> matches) Produce aResolvedInstancesusing the specifiedTypeQualifierand set of instancesIdentifies the constraints used to select matchestoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface oracle.dbtools.plugin.api.di.InstanceProvider
getOrNull, isAmbiguous, isAvailable, isUnavailable, orElse, streamMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
get
Description copied from interface:InstanceProviderRetrieve the first available instance -
hasMultiple
public boolean hasMultiple()Description copied from interface:InstanceProviderDetermines if there is more than one available implementation for the required type and qualifiers- Specified by:
hasMultiplein interfaceInstanceProvider<T>- Returns:
- true if there are multiple providers, false otherwise
-
isUnsatisfied
public boolean isUnsatisfied()Description copied from interface:InstanceProviderDetermines if there is no available implementation for the required type and qualifiers. If this method returns true, then callingInstanceProvider.get()will raise aRuntimeException- Specified by:
isUnsatisfiedin interfaceInstanceProvider<T>- Returns:
- true if there is no provider, false otherwise
-
iterator
Description copied from interface:InstanceProviderWhen a service has multiple providers (which can be determined by callingInstanceProvider.isAmbiguous()) this iterator enumerates each of the available providers -
qualifier
Description copied from interface:InstanceProviderIdentifies the constraints used to select matches- Specified by:
qualifierin interfaceInstanceProvider<T>- Returns:
TypeQualifierinstance
-
toString
-
matches
@SafeVarargs public static <T> ResolvedInstances<T> matches(InstanceProvider<T> firstMatch, InstanceProvider<T>... subsequentMatches) Concatenates a series of matches together- Type Parameters:
T- The type of the instances- Parameters:
firstMatch- The first set of matchessubsequentMatches- The remainder of the matches- Returns:
ResolvedInstancesinstance
-
matches
public static <T> ResolvedInstances<T> matches(TypeQualifier<T> qualifier, Collection<Throwable> errors, Iterable<T> matches) Produce aResolvedInstancesusing the specifiedTypeQualifierand set of instances- Type Parameters:
T- The type of the instances- Parameters:
errors- Any errors encountered in resolving the instancesqualifier- The constraints used to match the instancesmatches- The matches- Returns:
ResolvedInstancesinstance
-