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:
    Iterable<T>, Supplier<T>, javax.inject.Provider<T>, InstanceProvider<T>

      public class ResolvedInstances<T>
      extends Object
      implements InstanceProvider<T>

  Represents the discovered matches for a call to `InstanceLocator.select(TypeQualifier)`
  Since:
    19.3.0
  Author:
    cdivilly

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    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()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface oracle.dbtools.plugin.api.di.InstanceProvider

      `getOrNull, isAmbiguous, isAvailable, isUnavailable, orElse, stream`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Method Detail

    - #### get

          public T get()

      Description copied from interface: `InstanceProvider`
      Retrieve the first available instance
      Specified by:
        `get` in interface `Supplier<T>`
      Specified by:
        `get` in interface `javax.inject.Provider<T>`
      Specified by:
        `get` in interface `InstanceProvider<T>`
      Returns:
        the first available instance

    - #### hasMultiple

          public boolean hasMultiple()

      Description copied from interface: `InstanceProvider`
      Determines if there is more than one available implementation for the required type and qualifiers
      Specified by:
        `hasMultiple` in interface `InstanceProvider<T>`
      Returns:
        true if there are multiple providers, false otherwise

    - #### isUnsatisfied

          public boolean isUnsatisfied()

      Description copied from interface: `InstanceProvider`
      Determines if there is no available implementation for the required type and qualifiers. If this method returns true, then calling `InstanceProvider.get()` will raise a `RuntimeException`
      Specified by:
        `isUnsatisfied` in interface `InstanceProvider<T>`
      Returns:
        true if there is no provider, false otherwise

    - #### iterator

          public Iterator<T> iterator()

      Description copied from interface: `InstanceProvider`
      When a service has multiple providers (which can be determined by calling `InstanceProvider.isAmbiguous()`) this iterator enumerates each of the available providers
      Specified by:
        `iterator` in interface `Iterable<T>`
      Specified by:
        `iterator` in interface `InstanceProvider<T>`
      Returns:
        The set of available providers

    - #### qualifier

          public TypeQualifier<T> qualifier()

      Description copied from interface: `InstanceProvider`
      Identifies the constraints used to select matches
      Specified by:
        `qualifier` in interface `InstanceProvider<T>`
      Returns:
        `TypeQualifier` instance

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### 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 matches
        `subsequentMatches` - The remainder of the matches
      Returns:
        `ResolvedInstances` instance

    - #### matches

          public 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
      Type Parameters:
        `T` - The type of the instances
      Parameters:
        `errors` - Any errors encountered in resolving the instances
        `qualifier` - The constraints used to match the instances
        `matches` - The matches
      Returns:
        `ResolvedInstances` instance

Copyright © 2010, 2022, Oracle and/or its affiliates.