public interface ServicesManager
Modifier and Type | Method and Description |
---|---|
Collection<Class<?>> |
getKnownServices()
Returns a unmodifiable collection of the know services' classes.
|
<T> Optional<RegisteredServiceProvider<T>> |
getRegistration(Class<T> service)
Gets registration for the specified service
|
Collection<RegisteredServiceProvider<?>> |
getRegistrations(Class<?> service)
Returns an unmodifiable copy of all registrations for the specified service
|
Collection<RegisteredServiceProvider<?>> |
getRegistrations(Plugin plugin)
Returns a sorted by priority collection of all registered services by the
specified plugin.
|
default boolean |
hasRegistration(Class<?> service)
Checks if the specified service has a registration
|
default <T> void |
register(Plugin plugin,
Class<T> service,
T provider)
Registers a service
|
<T> void |
register(Plugin plugin,
Class<T> service,
T provider,
int priority)
Registers a service and sorts it by the specified priority.
|
<T> void |
unregister(Class<T> service,
T provider)
Unregisters a service
|
<T> void |
unregister(Plugin plugin,
Class<T> service)
Unregisters a service
|
int |
unregisterAll(Plugin plugin)
Unregisters all services, registered by the specified plugin
|
<T> void register(Plugin plugin, Class<T> service, T provider, int priority)
T
- typeplugin
- plugin registererservice
- service registeredprovider
- service instancepriority
- priority of the service. should be a number of which: -10, 1 or 10default <T> void register(Plugin plugin, Class<T> service, T provider)
T
- typeplugin
- plugin registererservice
- service registeredprovider
- service instanceregister(Plugin, Class, Object, int)
<T> void unregister(Plugin plugin, Class<T> service)
T
- typeplugin
- plugin registerer of this serviceservice
- service class<T> void unregister(Class<T> service, T provider)
T
- typeservice
- the service's class you want to unregisterprovider
- the provider you want to unregisterint unregisterAll(Plugin plugin)
plugin
- the plugin you wish to unregister its services<T> Optional<RegisteredServiceProvider<T>> getRegistration(Class<T> service)
T
- typeservice
- service classdefault boolean hasRegistration(Class<?> service)
service
- the service's class you want to checktrue
if hasCollection<RegisteredServiceProvider<?>> getRegistrations(Plugin plugin)
plugin
- the plugin you wish to get the registrations ofCollection<RegisteredServiceProvider<?>> getRegistrations(Class<?> service)
service
- the service of which you want to get the registrationsCollection<Class<?>> getKnownServices()
Copyright © 2019–2022. All rights reserved.