public interface ServicesManager
Modifier and Type | Method and Description |
---|---|
Collection<Class<?>> |
getKnownServices()
Get a list of known services.
|
<T> RegisteredServiceProvider<T> |
getRegistration(Class<T> service)
Queries for a provider registration.
|
<T> Collection<RegisteredServiceProvider<T>> |
getRegistrations(Class<T> service)
Get registrations of providers for a service.
|
List<RegisteredServiceProvider<?>> |
getRegistrations(Plugin plugin)
Get registrations of providers for a plugin.
|
<T> boolean |
isProvidedFor(Class<T> service)
Returns whether a provider has been registered for a service.
|
<T> T |
load(Class<T> service)
Queries for a provider.
|
<T> void |
register(Class<T> service,
T provider,
Plugin plugin,
ServicePriority priority)
Register a provider of a service.
|
void |
unregister(Class<?> service,
Object provider)
Unregister a particular provider for a particular service.
|
void |
unregister(Object provider)
Unregister a particular provider.
|
void |
unregisterAll(Plugin plugin)
Unregister all the providers registered by a particular plugin.
|
<T> void register(@NotNull Class<T> service, @NotNull T provider, @NotNull Plugin plugin, @NotNull ServicePriority priority)
T
- Providerservice
- service classprovider
- provider to registerplugin
- plugin with the providerpriority
- priority of the providervoid unregisterAll(@NotNull Plugin plugin)
plugin
- The pluginvoid unregister(@NotNull Class<?> service, @NotNull Object provider)
service
- The service interfaceprovider
- The service provider implementationvoid unregister(@NotNull Object provider)
provider
- The service provider implementation@Nullable <T> T load(@NotNull Class<T> service)
T
- The service interfaceservice
- The service interface@Nullable <T> RegisteredServiceProvider<T> getRegistration(@NotNull Class<T> service)
T
- The service interfaceservice
- The service interface@NotNull List<RegisteredServiceProvider<?>> getRegistrations(@NotNull Plugin plugin)
plugin
- The plugin@NotNull <T> Collection<RegisteredServiceProvider<T>> getRegistrations(@NotNull Class<T> service)
T
- The service interfaceservice
- The service interface@NotNull Collection<Class<?>> getKnownServices()
<T> boolean isProvidedFor(@NotNull Class<T> service)
load(service)
later, as that
would be a non-thread safe situation.T
- serviceservice
- service to checkCopyright © 2022. All rights reserved.