Package ch.kk7.confij.common
Class ServiceLoaderUtil
- java.lang.Object
-
- ch.kk7.confij.common.ServiceLoaderUtil
-
public class ServiceLoaderUtil extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ServiceLoaderUtil()
-
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 aServiceLoaderand sorts them byServiceLoaderPriorityfirst 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)
-
-
-
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 aServiceLoaderand sorts them byServiceLoaderPriorityfirst 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)
-
-