public class DefaultServiceRegistry extends Object implements ServiceRegistry
Service implementations and is capable of injecting them into ServiceProvider instances with
fields annotated with Inject. Optionality is supported by using Optional type when declared a field with
Inject. Method injection as Qualifier and Named annotations are not supported.| Constructor and Description |
|---|
DefaultServiceRegistry() |
| Modifier and Type | Method and Description |
|---|---|
Collection<org.mule.runtime.api.service.Service> |
getAllServices() |
<S extends org.mule.runtime.api.service.Service> |
getService(Class<? extends S> serviceInterface)
Gets the service implementation for the provided interface.
|
void |
inject(org.mule.runtime.api.service.ServiceProvider serviceProvider)
Injects the tracked
services into the given serviceProvider |
<S extends org.mule.runtime.api.service.Service> |
register(Class<? extends S> serviceContract,
S service) |
<S extends org.mule.runtime.api.service.Service> |
register(S service,
Class<? extends S> serviceContract)
Tracks the given
service |
<S extends org.mule.runtime.api.service.Service> |
unregister(Class<? extends S> serviceContract)
Un-tracks the given
service. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreatepublic void inject(org.mule.runtime.api.service.ServiceProvider serviceProvider)
throws ServiceResolutionError
services into the given serviceProviderserviceProvider - the injection targetServiceResolutionError - if a dependency could not be injectedpublic <S extends org.mule.runtime.api.service.Service> void register(S service,
Class<? extends S> serviceContract)
ServiceRegistryserviceregister in interface ServiceRegistryservice - the Service to be trackedpublic <S extends org.mule.runtime.api.service.Service> void register(Class<? extends S> serviceContract, S service)
public <S extends org.mule.runtime.api.service.Service> void unregister(Class<? extends S> serviceContract)
ServiceRegistryservice.unregister in interface ServiceRegistryS - the specific service interfaceserviceContract - the interface of the service to unregister, as declared in
ServiceAssembly.getServiceContract() on #register(Service, ServiceAssembly).public <S extends org.mule.runtime.api.service.Service> Optional<S> getService(Class<? extends S> serviceInterface)
ServiceRegistrygetService in interface ServiceRegistryS - the specific service interfaceregistered service for the provided
serviceInterface.public Collection<org.mule.runtime.api.service.Service> getAllServices()
getAllServices in interface ServiceRegistryregistered services.Copyright © 2003–2022 MuleSoft, Inc.. All rights reserved.