Package io.smallrye.stork.api
Interface StorkServiceRegistry
-
public interface StorkServiceRegistryThe central API of Stork
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StorkServiceRegistrydefineIfAbsent(String name, ServiceDefinition definition)Adds a service to the list of services managed by Stork.ServicegetService(String serviceName)Retrieves theServiceassociated with the given name.Optional<Service>getServiceOptional(String serviceName)Retrieves theServiceassociated with the given name.Map<String,Service>getServices()
-
-
-
Method Detail
-
getService
Service getService(String serviceName)
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
Optional<Service> getServiceOptional(String serviceName)
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
StorkServiceRegistry defineIfAbsent(String name, ServiceDefinition definition)
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.
-
-