Package ninja.utils
Class ForwardingServiceLoader<T>
- java.lang.Object
-
- ninja.utils.ForwardingServiceLoader<T>
-
public class ForwardingServiceLoader<T> extends Object
Forwards method calls to an underlying java.util.ServiceLoader -- mainly to allow participating and mocking in unit tests. Designed to be a drop-in replacement at the source-code level since java.util.ServiceLoader is final.
-
-
Constructor Summary
Constructors Constructor Description ForwardingServiceLoader(ServiceLoader<T> serviceLoader)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterator<T>
iterator()
static <T> ForwardingServiceLoader<T>
loadWithSystemServiceLoader(Class<T> service)
static <T> ForwardingServiceLoader<T>
loadWithSystemServiceLoader(Class<T> service, ClassLoader classLoader)
void
reload()
-
-
-
Constructor Detail
-
ForwardingServiceLoader
public ForwardingServiceLoader(ServiceLoader<T> serviceLoader)
-
-
Method Detail
-
reload
public void reload()
-
loadWithSystemServiceLoader
public static <T> ForwardingServiceLoader<T> loadWithSystemServiceLoader(Class<T> service)
-
loadWithSystemServiceLoader
public static <T> ForwardingServiceLoader<T> loadWithSystemServiceLoader(Class<T> service, ClassLoader classLoader)
-
-