Package net.fabricmc.loom.util.service
Class ScopedServiceFactory
java.lang.Object
net.fabricmc.loom.util.service.ScopedServiceFactory
- All Implemented Interfaces:
Closeable,AutoCloseable,ServiceFactory
An implementation of
ServiceFactory that creates services scoped to the factory instance.
When the factory is closed, all services created by it are closed and discarded.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()<O extends Service.Options,S extends Service<O>>
Sget(O options) Gets or creates a service instance with the given options.protected ServiceFactoryMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.fabricmc.loom.util.service.ServiceFactory
get, getOrNull
-
Constructor Details
-
ScopedServiceFactory
public ScopedServiceFactory()
-
-
Method Details
-
get
Description copied from interface:ServiceFactoryGets or creates a service instance with the given options.- Specified by:
getin interfaceServiceFactory- Type Parameters:
O- The options type.S- The service type.- Parameters:
options- The options to use.- Returns:
- The service instance.
-
getEffectiveServiceFactory
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-