- All Superinterfaces:
Registry
Default registry which use a simply key/value mechanism for storing and retrieving services.
- Since:
- 2.0.0
- Author:
- edgar
-
Method Summary
Modifier and TypeMethodDescriptionSet<Map.Entry<ServiceKey<?>,
jakarta.inject.Provider<?>>> entrySet()
Registered service entries.default <T> T
get
(ServiceKey<T> key) Retrieve a service/resource by key.default <T> T
Retrieve a service/resource by key.<T> T
getOrNull
(ServiceKey<T> key) Retrieve an existing service ornull
if not exists.default <T> T
Retrieve an existing service ornull
if not exists.Set<ServiceKey<?>>
keySet()
Registered service keys.<T> T
put
(ServiceKey<T> key, jakarta.inject.Provider<T> service) Put a service in this registry.<T> T
put
(ServiceKey<T> key, T service) Put a service in this registry.default <T> T
Put a service in this registry.default <T> T
Put a service in this registry.<T> T
putIfAbsent
(ServiceKey<T> key, jakarta.inject.Provider<T> service) Put/register a service in this registry if there isn't the same service already registered.<T> T
putIfAbsent
(ServiceKey<T> key, T service) Put/register a service in this registry if there isn't the same service already registered.default <T> T
putIfAbsent
(Class<T> type, jakarta.inject.Provider<T> service) Put/register a service in this registry if there isn't the same service already registered.default <T> T
putIfAbsent
(Class<T> type, T service) Put/register a service in this registry if there isn't the same service already registered.default <T> T
require
(ServiceKey<T> key) Provides an instance of the given type.default <T> T
Provides an instance of the given type.default <T> T
Provides an instance of the given type where name matches it.
-
Method Details
-
keySet
Registered service keys.- Returns:
- Service keys.
-
entrySet
Registered service entries.- Returns:
- Service entries.
-
get
Retrieve a service/resource by key.- Type Parameters:
T
- Service/resource type.- Parameters:
key
- Service/resource key.- Returns:
- Service.
- Throws:
RegistryException
- If there was a runtime failure while providing an instance.
-
get
Retrieve a service/resource by key.- Type Parameters:
T
- Service/resource type.- Parameters:
type
- Service/resource key.- Returns:
- Service.
- Throws:
RegistryException
- If there was a runtime failure while providing an instance.
-
getOrNull
Retrieve an existing service ornull
if not exists.- Type Parameters:
T
- Service/resource type.- Parameters:
key
- Service/resource key.- Returns:
- Service or
null
.
-
getOrNull
Retrieve an existing service ornull
if not exists.- Type Parameters:
T
- Service/resource type.- Parameters:
type
- Service/resource key.- Returns:
- Service or
null
.
-
put
Put a service in this registry. This method overrides any previous registered service.- Type Parameters:
T
- Service type.- Parameters:
type
- Service/resource key.service
- Service instance.- Returns:
- Previously registered service or
null
.
-
put
Put a service in this registry. This method overrides any previous registered service.- Type Parameters:
T
- Service type.- Parameters:
key
- Service/resource key.service
- Service instance.- Returns:
- Previously registered service or
null
.
-
put
Put a service in this registry. This method overrides any previous registered service.- Type Parameters:
T
- Service type.- Parameters:
type
- Service/resource key.service
- Service instance.- Returns:
- Previously registered service or
null
.
-
put
Put a service in this registry. This method overrides any previous registered service.- Type Parameters:
T
- Service type.- Parameters:
key
- Service/resource key.service
- Service instance.- Returns:
- Previously registered service or
null
.
-
putIfAbsent
Put/register a service in this registry if there isn't the same service already registered.- Type Parameters:
T
- Service type.- Parameters:
key
- Service/resource key.service
- Service instance.- Returns:
- Previously registered service or
null
.
-
putIfAbsent
Put/register a service in this registry if there isn't the same service already registered.- Type Parameters:
T
- Service type.- Parameters:
type
- Service/resource key.service
- Service instance.- Returns:
- Previously registered service or
null
.
-
putIfAbsent
Put/register a service in this registry if there isn't the same service already registered.- Type Parameters:
T
- Service type.- Parameters:
key
- Service/resource key.service
- Service instance.- Returns:
- Previously registered service or
null
.
-
putIfAbsent
Put/register a service in this registry if there isn't the same service already registered.- Type Parameters:
T
- Service type.- Parameters:
type
- Service/resource key.service
- Service instance.- Returns:
- Previously registered service or
null
.
-
require
Description copied from interface:Registry
Provides an instance of the given type. -
require
Description copied from interface:Registry
Provides an instance of the given type where name matches it. -
require
Description copied from interface:Registry
Provides an instance of the given type.- Specified by:
require
in interfaceRegistry
- Type Parameters:
T
- Object type.- Parameters:
key
- Object key.- Returns:
- Instance of this type.
- Throws:
RegistryException
- If there was a runtime failure while providing an instance.
-