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 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