Package net.fabricmc.loom.util.service
Interface ServiceFactory
- All Known Implementing Classes:
ScopedServiceFactory
public interface ServiceFactory
A factory for creating
Service instances.-
Method Summary
Modifier and TypeMethodDescription<O extends Service.Options,S extends Service<O>>
Sget(O options) Gets or creates a service instance with the given options.default <O extends Service.Options,S extends Service<O>>
Sget(org.gradle.api.provider.Provider<O> options) Gets or creates a service instance with the given options.default <O extends Service.Options,S extends Service<O>>
@Nullable SgetOrNull(org.gradle.api.provider.Provider<O> options) Gets or creates a service instance with the given options, or returns null if the options are not present.
-
Method Details
-
get
default <O extends Service.Options,S extends Service<O>> S get(org.gradle.api.provider.Provider<O> options) Gets or creates a service instance with the given options.- Type Parameters:
O- The options type.S- The service type.- Parameters:
options- The options to use.- Returns:
- The service instance.
-
getOrNull
default <O extends Service.Options,S extends Service<O>> @Nullable S getOrNull(org.gradle.api.provider.Provider<O> options) Gets or creates a service instance with the given options, or returns null if the options are not present.- Type Parameters:
O- The options type.S- The service type.- Parameters:
options- The options to use.- Returns:
- The service instance, or null if the options are not present.
-
get
Gets or creates a service instance with the given options.- Type Parameters:
O- The options type.S- The service type.- Parameters:
options- The options to use.- Returns:
- The service instance.
-