public final class ServiceUtil
extends java.lang.Object
ServiceLoader.| Modifier and Type | Method and Description |
|---|---|
static <T> T |
loadSingletonService(java.lang.Class<T> type)
Loads a service of the given type and ensures it has exactly one implementation.
|
static <T> T |
loadSingletonServiceOrNull(java.lang.Class<T> type)
Loads a service of the given type and ensures it has either one implementation or none.
|
public static <T> T loadSingletonServiceOrNull(java.lang.Class<T> type)
type - The service's type.null if not.java.lang.Error - if more than one implementation of the service have been found.public static <T> T loadSingletonService(java.lang.Class<T> type)
type - The service's type.java.lang.Error - if no implementation has been found or if more than one implementation of the service have been found.