Class ServiceRegistry<K,S>
java.lang.Object
org.eclipse.rdf4j.common.lang.service.ServiceRegistry<K,S>
- Direct Known Subclasses:
DatatypeHandlerRegistry
,FileFormatServiceRegistry
,FunctionRegistry
,LanguageHandlerRegistry
,QueryParserRegistry
,RepositoryRegistry
,SailRegistry
,TransactionSettingRegistry
,TupleFunctionRegistry
A registry that stores services by some key. Upon initialization, the registry searches for service description files
at META-INF/services/<service class name> and initializes itself accordingly.
- Author:
- Arjohn Kampman
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds a service to the registry.Gets the service for the specified key, if any.getAll()
Gets all registered services.protected abstract K
Gets the key for the specified service.getKeys()
Gets the set of registered keys.boolean
Checks whether a service for the specified key is available.void
Removes a service from the registry.
-
Field Details
-
logger
protected final org.slf4j.Logger logger -
services
-
-
Constructor Details
-
ServiceRegistry
-
-
Method Details
-
add
Adds a service to the registry. Any service that is currently registered for the same key (as specified bygetKey(Object)
) will be replaced with the new service.- Parameters:
service
- The service that should be added to the registry.- Returns:
- The previous service that was registered for the same key, or
Optional.empty()
if there was no such service.
-
remove
Removes a service from the registry.- Parameters:
service
- The service be removed from the registry.
-
get
Gets the service for the specified key, if any.- Parameters:
key
- The key identifying which service to get.- Returns:
- The service for the specified key, or
Optional.empty()
if no such service is avaiable.
-
has
Checks whether a service for the specified key is available.- Parameters:
key
- The key identifying which service to search for.- Returns:
- true if a service for the specific key is available, false otherwise.
-
getAll
Gets all registered services.- Returns:
- An unmodifiable collection containing all registered servivces.
-
getKeys
Gets the set of registered keys.- Returns:
- An unmodifiable set containing all registered keys.
-
getKey
Gets the key for the specified service.- Parameters:
service
- The service to get the key for.- Returns:
- The key for the specified service.
-