Class ServiceLoaders

java.lang.Object
com.complexible.common.util.ServiceLoaders

public final class ServiceLoaders extends Object

Wrapper around the Java ServiceLoader class which returns collections of instances of an interface as opposed to iterators over instances that the normal ServiceLoader returns.

Since:
0.4.5
Version:
4.0.3
Author:
Michael Grove
See Also:
  • Method Details

    • instancesOf

      public static <T> Collection<T> instancesOf(Class<T> theClass)
      Return instances of all the classes which extend from the specified class
      Type Parameters:
      T - the type
      Parameters:
      theClass - the parent interface/abstract class
      Returns:
      a collection of new instances (created using the default constructor)
    • classesOf

      public static <T> Collection<Class<? extends T>> classesOf(Class<T> theClass)
      Return the class objects for all classes which extend from the specified class
      Type Parameters:
      T - the type
      Parameters:
      theClass - the parent interface/abstract class
      Returns:
      a collection of class objects for concrete implementations of the provided class.