Package org.apache.groovy.contracts.util

# Class LifecycleImplementationLoader<S>

java.lang.Object
org.apache.groovy.contracts.util.LifecycleImplementationLoader<S>

All Implemented Interfaces:
  `Iterable<S>`

public final class LifecycleImplementationLoader<S> extends Object implements Iterable<S>

Finds and loads implementation classes of interface `Lifecycle`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Iterator<S>`
  `iterator()`
  Returns an iterator over already loaded providers followed by lazily discovered providers.
  `static <S> LifecycleImplementationLoader<S>`
  `load(Class<S> service, ClassLoader loader)`
  Creates a new `Lifecycle` for the given type and class loader.
  `void`
  `reload()`
  Clears cached providers and restarts service discovery.

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

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

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

  `forEach, spliterator`

- ## Method Details

  - ### reload

    public void reload()
    Clears cached providers and restarts service discovery.

  - ### iterator

    public Iterator<S> iterator()
    Returns an iterator over already loaded providers followed by lazily discovered providers.
    Specified by:
      `iterator` in interface `Iterable<S>`
    Returns:
      an iterator across provider instances

  - ### load

    public static <S> LifecycleImplementationLoader<S> load(Class<S> service, ClassLoader loader)
    Creates a new `Lifecycle` for the given type and class loader.
    Type Parameters:
      `S` - the service type
    Parameters:
      `service` - the service type to load
      `loader` - the class loader used to discover providers
    Returns:
      a loader for the requested service type