Package io.smallrye.stork.api
Interface StorkServiceRegistry
public interface StorkServiceRegistry
The central API of Stork
-
Method Summary
Modifier and TypeMethodDescriptiondefineIfAbsent(String name, ServiceDefinition definition) Adds a service to the list of services managed by Stork.getService(String serviceName) Retrieves theServiceassociated with the given name.getServiceOptional(String serviceName) Retrieves theServiceassociated with the given name.
-
Method Details
-
getService
Retrieves theServiceassociated with the given name.- Parameters:
serviceName- the service name, must not benull- Returns:
- the service
- Throws:
NoSuchServiceDefinitionException- if there is no service associated with the given name.
-
getServiceOptional
Retrieves theServiceassociated with the given name. UnlikegetService(String)this method returns anOptionaland so does not throw aNoSuchServiceDefinitionExceptionif there is noServiceassociated with the given name. -
defineIfAbsent
Adds a service to the list of services managed by Stork. The service is only added if there is no service with that name already defined. Otherwise, the service definition is ignored.- Parameters:
name- the service name, must not benullor blankdefinition- the definition, must not benull- Returns:
- the Stork instance. // TODO Define exception.
-
getServices
- Returns:
- all the services managed by Stork. The returned map is immutable.
-