Package org.xmldb.api.base
Class ServiceProviderCache
- java.lang.Object
-
- org.xmldb.api.base.ServiceProviderCache
-
- All Implemented Interfaces:
ServiceProvider
public final class ServiceProviderCache extends java.lang.Object implements ServiceProvider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceServiceProviderCache.ProviderRegistryRegistry used to add available service providers.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <S extends Service>
java.util.Optional<S>findService(java.lang.Class<S> serviceType)Returns optionalServiceinstance for the requestedserviceType.<S extends Service>
booleanhasService(java.lang.Class<S> serviceType)Checks if a service of the given serviceType is available.static ServiceProviderCachewithRegistered(java.util.function.Consumer<ServiceProviderCache.ProviderRegistry> registry)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.xmldb.api.base.ServiceProvider
getService
-
-
-
-
Method Detail
-
withRegistered
public static ServiceProviderCache withRegistered(java.util.function.Consumer<ServiceProviderCache.ProviderRegistry> registry)
-
hasService
public <S extends Service> boolean hasService(java.lang.Class<S> serviceType)
Description copied from interface:ServiceProviderChecks if a service of the given serviceType is available. This method will returnfalsein case of the specified service can not be provided for any reason.- Specified by:
hasServicein interfaceServiceProvider- Returns:
trueif the given service type is supported,false otherwise
-
findService
public <S extends Service> java.util.Optional<S> findService(java.lang.Class<S> serviceType)
Description copied from interface:ServiceProviderReturns optionalServiceinstance for the requestedserviceType. If noServiceexists or can be provided an empty optional is returned.- Specified by:
findServicein interfaceServiceProvider- Type Parameters:
S- the type of service- Parameters:
serviceType- the type of service to return- Returns:
- a optional instance of the given service type
-
-