Interface ServicesManager
public interface ServicesManager
Represents a manager of services, registered by plugins and probably used by
other plugins
-
Method Summary
Modifier and TypeMethodDescriptionCollection<Class<?>>Returns a unmodifiable collection of the know services' classes.<T> Optional<RegisteredServiceProvider<T>>getRegistration(Class<T> service) Gets registration for the specified servicegetRegistrations(Class<?> service) Returns an unmodifiable copy of all registrations for the specified servicegetRegistrations(Plugin plugin) Returns a sorted by priority collection of all registered services by the specified plugin.default booleanhasRegistration(Class<?> service) Checks if the specified service has a registrationdefault <T> voidRegisters a service<T> voidRegisters a service and sorts it by the specified priority.<T> voidunregister(Class<T> service, T provider) Unregisters a service<T> voidunregister(Plugin plugin, Class<T> service) Unregisters a serviceintunregisterAll(Plugin plugin) Unregisters all services, registered by the specified plugin
-
Method Details
-
register
Registers a service and sorts it by the specified priority.- Type Parameters:
T- type- Parameters:
plugin- plugin registererservice- service registeredprovider- service instancepriority- priority of the service. should be a number of which: -10, 1 or 10
-
register
Registers a service- Type Parameters:
T- type- Parameters:
plugin- plugin registererservice- service registeredprovider- service instance- See Also:
-
unregister
Unregisters a service- Type Parameters:
T- type- Parameters:
plugin- plugin registerer of this serviceservice- service class
-
unregister
Unregisters a service- Type Parameters:
T- type- Parameters:
service- the service's class you want to unregisterprovider- the provider you want to unregister
-
unregisterAll
Unregisters all services, registered by the specified plugin- Parameters:
plugin- the plugin you wish to unregister its services- Returns:
- the count of services unregistered
-
getRegistration
Gets registration for the specified service- Type Parameters:
T- type- Parameters:
service- service class- Returns:
- service provider if registered, otherwise empty optional
-
hasRegistration
Checks if the specified service has a registration- Parameters:
service- the service's class you want to check- Returns:
trueif has
-
getRegistrations
Returns a sorted by priority collection of all registered services by the specified plugin.- Parameters:
plugin- the plugin you wish to get the registrations of- Returns:
- collection with the services, or empty collection if no services registered
-
getRegistrations
Returns an unmodifiable copy of all registrations for the specified service- Parameters:
service- the service of which you want to get the registrations- Returns:
- registrations or empty collection if no found
-
getKnownServices
Collection<Class<?>> getKnownServices()Returns a unmodifiable collection of the know services' classes.- Returns:
- known services, or empty if no services registered
-