public class ServiceManager<T extends AbstractServiceProvider> extends Object
ServiceManager contains instances of service providers that perform some function within the client.| Constructor and Description |
|---|
ServiceManager(GameClient gameClient)
Initializes a new
ServiceManager. |
| Modifier and Type | Method and Description |
|---|---|
<V extends T> |
get(Class<V> clazz)
Gets the service provider instance specified by the provided class.
|
Set<T> |
getServiceProviders()
Retrieves all service provider instances that are currently registered with this service provider as a
Set. |
<V extends T> |
register(Class<V> clazz)
Registers a new service provider instance with this service manager, specified by the provided class.
|
boolean |
register(T serviceProvider)
Registers a service provider instance with this service manager.
|
<V extends T> |
remove(Class<V> clazz)
Removes a service provider from the service manager.
|
<V extends T> |
remove(V serviceProvider)
Removes a service provider from the service manager.
|
void |
removeAll()
Removes all service providers from this service manager.
|
public ServiceManager(GameClient gameClient)
ServiceManager.gameClient - The GameClient that owns this service managerpublic Set<T> getServiceProviders()
Set.Set of service provider instances currently registered with this service managerpublic <V extends T> V get(Class<V> clazz)
null is returned.V - Type of service provider expectedclazz - Class of service provider to be retrievednull is returned.public boolean register(T serviceProvider)
serviceProvider - Service provider instancetrue if the service provider was registered successfully, false otherwisepublic <V extends T> boolean register(Class<V> clazz)
GameClient).V - Type of service provider to be registeredclazz - Class of service provider to be registeredtrue if the service provider was registered successfully, false otherwisepublic <V extends T> boolean remove(V serviceProvider)
V - Type of service provider to be removedserviceProvider - Service provider instancetrue if the service provider was removed successfully, false otherwisepublic <V extends T> boolean remove(Class<V> clazz)
V - Type of service provider to be removedclazz - Class of service provider to be registeredtrue if the service provider was removed successfully, false otherwisepublic void removeAll()
Copyright © 2018. All rights reserved.