Package com.avrix.plugin
Class ServiceManager
java.lang.Object
com.avrix.plugin.ServiceManager
The service manager allows you to register services by their interfaces and access them
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TgetService(Class<T> serviceInterface) Returns the registered service by its interface.static <T> voidRegisters a service by its interface.static <T> voidunregister(Class<T> serviceInterface) Removes a service from the list of registered ones
-
Constructor Details
-
ServiceManager
public ServiceManager()
-
-
Method Details
-
register
Registers a service by its interface.- Type Parameters:
T- service type- Parameters:
serviceInterface- service interfaceserviceImplementation- service implementation
-
unregister
Removes a service from the list of registered ones- Type Parameters:
T- service type- Parameters:
serviceInterface- service interface
-
getService
Returns the registered service by its interface.- Type Parameters:
T- service type- Parameters:
serviceInterface- service interface- Returns:
- an instance of the service corresponding to the specified interface, or
nullif the service is not found
-