ServiceRegistry
is used to allow concrete class instances to register as the provider of
a particular service within a given application.
Blades aren't allowed to depend directly on classes in other blades. Instead, interface definitions are created
for particular pieces of functionality, and blades can choose to register themselves as being providers of that
functionality. The ServiceRegistry
and the caplin.core.event.EventHub are both useful
in this regard:
ServiceRegistry
.Attributes | Name and Description |
---|---|
|
caplin.core.ServiceRegistry()
The ServiceRegistry is a static class and does not need to be constructed. |
Attributes | Name and Description |
---|---|
<static>
|
void
deregisterService(String sInterface)
De-register an object that has previously been registered using |
<static>
|
Object
getService(caplin.core.ServiceRegistry sInterface)
Retrieve the object responsible for implementing the given interface within the application. |
<static>
|
boolean
isServiceRegistered(caplin.core.ServiceRegistry sInterface)
Determine whether a service has been registered for a given interface. |
<static>
|
void
registerService(String sInterface, Object oServiceInstance)
Register an object that will be responsible for implementing the given interface within the application. |
►
caplin.core.ServiceRegistry()
The ServiceRegistry is a static class and does not need to be constructed.
►
<static>
void
deregisterService(String sInterface)
De-register an object that has previously been registered using registerService
.
String | sInterface | The interface the service being de-registered implements. |
►
<static>
Object
getService(caplin.core.ServiceRegistry sInterface)
Retrieve the object responsible for implementing the given interface within the application.
caplin.core.ServiceRegistry | sInterface | The interface the service instance being retrieved implements. |
►
<static>
boolean
isServiceRegistered(caplin.core.ServiceRegistry sInterface)
Determine whether a service has been registered for a given interface.
caplin.core.ServiceRegistry | sInterface | The name of the interface being queried. |
►
<static>
void
registerService(String sInterface, Object oServiceInstance)
Register an object that will be responsible for implementing the given interface within the application.
String | sInterface | The interface the service being registered implements. |
Object | oServiceInstance | The object responsible for implementing the given interface. |