Class ServiceLoaders


  • public final class ServiceLoaders
    extends java.lang.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:
    ClassServiceLoader
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.util.Collection<java.lang.Class<? extends T>> classesOf​(java.lang.Class<T> theClass)
      Return the class objects for all classes which extend from the specified class
      static <T> java.util.Collection<T> instancesOf​(java.lang.Class<T> theClass)
      Return instances of all the classes which extend from the specified class
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • instancesOf

        public static <T> java.util.Collection<T> instancesOf​(java.lang.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> java.util.Collection<java.lang.Class<? extends T>> classesOf​(java.lang.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.