Class ServiceLoaderUtil


  • public class ServiceLoaderUtil
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> java.util.List<T> instancesOf​(java.lang.Class<T> serviceClass)
      Loads and caches all instances of a given class using a ServiceLoader and sorts them by ServiceLoaderPriority first and by class name otherwise.
      <T> java.util.List<T> maybeNewOf​(java.lang.Class<T> serviceClass)  
      <T> java.util.List<T> requireInstancesOf​(java.lang.Class<T> serviceClass)  
      • Methods inherited from class java.lang.Object

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

      • ServiceLoaderUtil

        public ServiceLoaderUtil()
    • Method Detail

      • requireInstancesOf

        public <T> java.util.List<T> requireInstancesOf​(java.lang.Class<T> serviceClass)
      • instancesOf

        public <T> java.util.List<T> instancesOf​(java.lang.Class<T> serviceClass)
        Loads and caches all instances of a given class using a ServiceLoader and sorts them by ServiceLoaderPriority first and by class name otherwise.
        Returns:
        list of initialized singletons of given type in deterministic order
      • maybeNewOf

        public <T> java.util.List<T> maybeNewOf​(java.lang.Class<T> serviceClass)