ServicesManager
public class SimpleServicesManager extends Object implements ServicesManager
Constructor | Description |
---|---|
SimpleServicesManager() |
Modifier and Type | Method | Description |
---|---|---|
@NotNull Set<Class<?>> |
getKnownServices() |
Get a list of known services.
|
<T> @Nullable RegisteredServiceProvider<T> |
getRegistration(@NotNull Class<T> service) |
Queries for a provider registration.
|
<T> @NotNull List<RegisteredServiceProvider<T>> |
getRegistrations(@NotNull Class<T> service) |
Get registrations of providers for a service.
|
@NotNull List<RegisteredServiceProvider<?>> |
getRegistrations(@NotNull Plugin plugin) |
Get registrations of providers for a plugin.
|
<T> boolean |
isProvidedFor(@NotNull Class<T> service) |
Returns whether a provider has been registered for a service.
|
<T> T |
load(@NotNull Class<T> service) |
Queries for a provider.
|
<T> void |
register(@NotNull Class<T> service,
T provider,
@NotNull Plugin plugin,
@NotNull ServicePriority priority) |
Register a provider of a service.
|
void |
unregister(@NotNull Class<?> service,
@NotNull Object provider) |
Unregister a particular provider for a particular service.
|
void |
unregister(@NotNull Object provider) |
Unregister a particular provider.
|
void |
unregisterAll(@NotNull Plugin plugin) |
Unregister all the providers registered by a particular plugin.
|
public <T> void register(@NotNull @NotNull Class<T> service, @NotNull T provider, @NotNull @NotNull Plugin plugin, @NotNull @NotNull ServicePriority priority)
register
in interface ServicesManager
T
- Providerservice
- service classprovider
- provider to registerplugin
- plugin with the providerpriority
- priority of the providerpublic void unregisterAll(@NotNull @NotNull Plugin plugin)
unregisterAll
in interface ServicesManager
plugin
- The pluginpublic void unregister(@NotNull @NotNull Class<?> service, @NotNull @NotNull Object provider)
unregister
in interface ServicesManager
service
- The service interfaceprovider
- The service provider implementationpublic void unregister(@NotNull @NotNull Object provider)
unregister
in interface ServicesManager
provider
- The service provider implementation@Nullable public <T> T load(@NotNull @NotNull Class<T> service)
load
in interface ServicesManager
T
- The service interfaceservice
- The service interface@Nullable public <T> @Nullable RegisteredServiceProvider<T> getRegistration(@NotNull @NotNull Class<T> service)
getRegistration
in interface ServicesManager
T
- The service interfaceservice
- The service interface@NotNull public @NotNull List<RegisteredServiceProvider<?>> getRegistrations(@NotNull @NotNull Plugin plugin)
getRegistrations
in interface ServicesManager
plugin
- The plugin@NotNull public <T> @NotNull List<RegisteredServiceProvider<T>> getRegistrations(@NotNull @NotNull Class<T> service)
getRegistrations
in interface ServicesManager
T
- The service interfaceservice
- The service interface@NotNull public @NotNull Set<Class<?>> getKnownServices()
getKnownServices
in interface ServicesManager
public <T> boolean isProvidedFor(@NotNull @NotNull Class<T> service)
isProvidedFor
in interface ServicesManager
T
- serviceservice
- service to checkCopyright © 2020. All rights reserved.