@@ -7,17 +7,17 @@ import java.util.List;
|
||||
* Manages services and service providers. Services are an interface specifying
|
||||
* a list of methods that a provider must implement. Providers are
|
||||
* implementations of these services. A provider can be queried from the
|
||||
* services manager in order to use a service (if one is available). If
|
||||
* services manager in order to use a service (if one is available). If
|
||||
* multiple plugins register a service, then the service with the highest
|
||||
* priority takes precedence.
|
||||
*
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public interface ServicesManager {
|
||||
|
||||
/**
|
||||
* Register a provider of a service.
|
||||
*
|
||||
*
|
||||
* @param <T> Provider
|
||||
* @param service service class
|
||||
* @param provider provider to register
|
||||
@@ -29,22 +29,22 @@ public interface ServicesManager {
|
||||
|
||||
/**
|
||||
* Unregister all the providers registered by a particular plugin.
|
||||
*
|
||||
*
|
||||
* @param plugin
|
||||
*/
|
||||
public void unregisterAll(Plugin plugin);
|
||||
|
||||
/**
|
||||
* Unregister a particular provider for a particular service.
|
||||
*
|
||||
* @param service
|
||||
*
|
||||
* @param service
|
||||
* @param provider
|
||||
*/
|
||||
public void unregister(Class<?> service, Object provider);
|
||||
|
||||
/**
|
||||
* Unregister a particular provider.
|
||||
*
|
||||
*
|
||||
* @param provider
|
||||
*/
|
||||
public void unregister(Object provider);
|
||||
@@ -52,7 +52,7 @@ public interface ServicesManager {
|
||||
/**
|
||||
* Queries for a provider. This may return if no provider has been
|
||||
* registered for a service. The highest priority provider is returned.
|
||||
*
|
||||
*
|
||||
* @param <T>
|
||||
* @param service
|
||||
* @return provider or null
|
||||
@@ -62,7 +62,7 @@ public interface ServicesManager {
|
||||
/**
|
||||
* Queries for a provider registration. This may return if no provider
|
||||
* has been registered for a service.
|
||||
*
|
||||
*
|
||||
* @param <T>
|
||||
* @param service
|
||||
* @return provider registration or null
|
||||
@@ -71,7 +71,7 @@ public interface ServicesManager {
|
||||
|
||||
/**
|
||||
* Get registrations of providers for a plugin.
|
||||
*
|
||||
*
|
||||
* @param plugin
|
||||
* @return provider registration or null
|
||||
*/
|
||||
@@ -80,7 +80,7 @@ public interface ServicesManager {
|
||||
/**
|
||||
* Get registrations of providers for a service. The returned list is
|
||||
* unmodifiable.
|
||||
*
|
||||
*
|
||||
* @param <T>
|
||||
* @param service
|
||||
* @return list of registrations
|
||||
@@ -91,7 +91,7 @@ public interface ServicesManager {
|
||||
/**
|
||||
* Get a list of known services. A service is known if it has registered
|
||||
* providers for it.
|
||||
*
|
||||
*
|
||||
* @return list of known services
|
||||
*/
|
||||
public Collection<Class<?>> getKnownServices();
|
||||
@@ -99,12 +99,12 @@ public interface ServicesManager {
|
||||
/**
|
||||
* Returns whether a provider has been registered for a service. Do not
|
||||
* check this first only to call <code>load(service)</code> later, as that
|
||||
* would be a non-thread safe situation.
|
||||
*
|
||||
* would be a non-thread safe situation.
|
||||
*
|
||||
* @param <T> service
|
||||
* @param service service to check
|
||||
* @return whether there has been a registered provider
|
||||
*/
|
||||
public <T> boolean isProvidedFor(Class<T> service);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user