Class DefaultServicesRegistry
- java.lang.Object
-
- de.dytanic.cloudnet.common.registry.DefaultServicesRegistry
-
- All Implemented Interfaces:
IServicesRegistry
public class DefaultServicesRegistry extends java.lang.Object implements IServicesRegistry
This is the default implementation of the IServicesRegistry class.- See Also:
IServicesRegistry
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDefaultServicesRegistry.RegistryEntry<T>
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.Class<?>,java.util.List<DefaultServicesRegistry.RegistryEntry<?>>>providedServices
-
Constructor Summary
Constructors Constructor Description DefaultServicesRegistry()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> booleancontainsService(java.lang.Class<T> clazz, java.lang.String name)Default implementation of IServiceRegistry classjava.util.Collection<java.lang.Class<?>>getProvidedServices()Default implementation of IServiceRegistry class<T> TgetService(java.lang.Class<T> clazz, java.lang.String name)Default implementation of IServiceRegistry class<T> java.util.Collection<T>getServices(java.lang.Class<T> clazz)Default implementation of IServiceRegistry class<T,E extends T>
IServicesRegistryregisterService(java.lang.Class<T> clazz, java.lang.String name, E service)Default implementation of IServiceRegistry classIServicesRegistryunregisterAll()Default implementation of IServiceRegistry classIServicesRegistryunregisterAll(java.lang.ClassLoader classLoader)Default implementation of IServiceRegistry class<T,E extends T>
IServicesRegistryunregisterService(java.lang.Class<T> clazz, E service)Default implementation of IServiceRegistry class<T,E extends T>
IServicesRegistryunregisterService(java.lang.Class<T> clazz, java.lang.Class<E> serviceClazz)Default implementation of IServiceRegistry class<T> IServicesRegistryunregisterService(java.lang.Class<T> clazz, java.lang.String name)Default implementation of IServiceRegistry class<T> IServicesRegistryunregisterServices(java.lang.Class<T> clazz)Default implementation of IServiceRegistry class-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.dytanic.cloudnet.common.registry.IServicesRegistry
getFirstService
-
-
-
-
Field Detail
-
providedServices
protected final java.util.Map<java.lang.Class<?>,java.util.List<DefaultServicesRegistry.RegistryEntry<?>>> providedServices
-
-
Method Detail
-
registerService
public <T,E extends T> IServicesRegistry registerService(java.lang.Class<T> clazz, java.lang.String name, E service)
Default implementation of IServiceRegistry class- Specified by:
registerServicein interfaceIServicesRegistry- Type Parameters:
T- the interface or abstract type which you want the implementation providing forE- the implementation of the service type T- Parameters:
clazz- the interface class, which should the provider of the servicename- the name of the service, which should registeredservice- the service instance to register- Returns:
- the current instance, of the class, which was used to offerTask this method
- See Also:
IServicesRegistry
-
unregisterService
public <T,E extends T> IServicesRegistry unregisterService(java.lang.Class<T> clazz, java.lang.Class<E> serviceClazz)
Default implementation of IServiceRegistry class- Specified by:
unregisterServicein interfaceIServicesRegistry- Type Parameters:
T- the interface or abstract type which you want the implementation providing forE- the implementation of the service type T- Parameters:
clazz- the interface class, which should the provider of the serviceserviceClazz- the class, of the services which should unregister- Returns:
- the current instance of the ServiceRegistry
- See Also:
IServicesRegistry
-
unregisterService
public <T,E extends T> IServicesRegistry unregisterService(java.lang.Class<T> clazz, E service)
Default implementation of IServiceRegistry class- Specified by:
unregisterServicein interfaceIServicesRegistry- Type Parameters:
T- the interface or abstract type which you want the implementation providing forE- the implementation of the service type T- Parameters:
clazz- the interface class, which should the provider of the serviceservice- the instance- Returns:
- the current instance of the ServiceRegistry
- See Also:
IServicesRegistry
-
containsService
public <T> boolean containsService(java.lang.Class<T> clazz, java.lang.String name)Default implementation of IServiceRegistry class- Specified by:
containsServicein interfaceIServicesRegistry- Type Parameters:
T- the interface or abstract type which you want the implementation providing for- Parameters:
clazz- the provider classname- the name of the service, from that should be check- Returns:
- true if a service from the provider is contain in this registry
- See Also:
IServicesRegistry
-
unregisterService
public <T> IServicesRegistry unregisterService(java.lang.Class<T> clazz, java.lang.String name)
Default implementation of IServiceRegistry class- Specified by:
unregisterServicein interfaceIServicesRegistry- Type Parameters:
T- the interface or abstract type which you want the implementation providing for- Parameters:
clazz- the base class from that the service should be removedname- the registered name from the service implementation- Returns:
- the current instance of the ServiceRegistry
- See Also:
IServicesRegistry
-
unregisterServices
public <T> IServicesRegistry unregisterServices(java.lang.Class<T> clazz)
Default implementation of IServiceRegistry class- Specified by:
unregisterServicesin interfaceIServicesRegistry- Type Parameters:
T- the interface or abstract type which you want the implementation providing for- Parameters:
clazz- the provider base class from that should all services be removed- Returns:
- the current instance of the ServiceRegistry
- See Also:
IServicesRegistry
-
unregisterAll
public IServicesRegistry unregisterAll()
Default implementation of IServiceRegistry class- Specified by:
unregisterAllin interfaceIServicesRegistry- Returns:
- the current instance of the ServiceRegistry
- See Also:
IServicesRegistry
-
unregisterAll
public IServicesRegistry unregisterAll(java.lang.ClassLoader classLoader)
Default implementation of IServiceRegistry class- Specified by:
unregisterAllin interfaceIServicesRegistry- Parameters:
classLoader- the classLoader, from that all services should be removed- Returns:
- the current instance of the ServiceRegistry
- See Also:
IServicesRegistry
-
getProvidedServices
public java.util.Collection<java.lang.Class<?>> getProvidedServices()
Default implementation of IServiceRegistry class- Specified by:
getProvidedServicesin interfaceIServicesRegistry- See Also:
IServicesRegistry
-
getService
public <T> T getService(java.lang.Class<T> clazz, java.lang.String name)Default implementation of IServiceRegistry class- Specified by:
getServicein interfaceIServicesRegistry- Type Parameters:
T- the interface or abstract type which you want the implementation providing for- Parameters:
clazz- the base provider class, from that the service should getname- the name of the service that should get- Returns:
- the service implementation of the base class or the base class himself
- See Also:
IServicesRegistry
-
getServices
public <T> java.util.Collection<T> getServices(java.lang.Class<T> clazz)
Default implementation of IServiceRegistry class- Specified by:
getServicesin interfaceIServicesRegistry- Type Parameters:
T- the interface or abstract type which you want the implementation providing for- Parameters:
clazz- the base provider class, from that the service should get- Returns:
- the service implementations of the base class or the base class himself
- See Also:
IServicesRegistry
-
-