public interface ServiceRegistry extends Registry
Modifier and Type | Method and Description |
---|---|
Set<Map.Entry<ServiceKey<?>,javax.inject.Provider<?>>> |
entrySet()
Registered service entries.
|
default <T> T |
get(Class<T> type)
Retrieve a service/resource by key.
|
default <T> T |
get(ServiceKey<T> key)
Retrieve a service/resource by key.
|
default <T> T |
getOrNull(Class<T> type)
Retrieve an existing service or
null if not exists. |
<T> T |
getOrNull(ServiceKey<T> key)
Retrieve an existing service or
null if not exists. |
Set<ServiceKey<?>> |
keySet()
Registered service keys.
|
default <T> T |
put(Class<T> type,
javax.inject.Provider<T> service)
Put a service in this registry.
|
default <T> T |
put(Class<T> type,
T service)
Put a service in this registry.
|
<T> T |
put(ServiceKey<T> key,
javax.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 |
putIfAbsent(Class<T> type,
javax.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.
|
<T> T |
putIfAbsent(ServiceKey<T> key,
javax.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 |
require(Class<T> type)
Provides an instance of the given type.
|
default <T> T |
require(Class<T> type,
String name)
Provides an instance of the given type where name matches it.
|
default <T> T |
require(ServiceKey<T> key)
Provides an instance of the given type.
|
@Nonnull Set<ServiceKey<?>> keySet()
@Nonnull Set<Map.Entry<ServiceKey<?>,javax.inject.Provider<?>>> entrySet()
@Nonnull default <T> T get(@Nonnull ServiceKey<T> key)
T
- Service/resource type.key
- Service/resource key.RegistryException
- If there was a runtime failure while providing an instance.@Nonnull default <T> T get(@Nonnull Class<T> type)
T
- Service/resource type.type
- Service/resource key.RegistryException
- If there was a runtime failure while providing an instance.@Nullable <T> T getOrNull(@Nonnull ServiceKey<T> key)
null
if not exists.T
- Service/resource type.key
- Service/resource key.null
.@Nullable default <T> T getOrNull(@Nonnull Class<T> type)
null
if not exists.T
- Service/resource type.type
- Service/resource key.null
.@Nullable default <T> T put(@Nonnull Class<T> type, javax.inject.Provider<T> service)
T
- Service type.type
- Service/resource key.service
- Service instance.null
.@Nullable <T> T put(@Nonnull ServiceKey<T> key, javax.inject.Provider<T> service)
T
- Service type.key
- Service/resource key.service
- Service instance.null
.@Nullable default <T> T put(@Nonnull Class<T> type, T service)
T
- Service type.type
- Service/resource key.service
- Service instance.null
.@Nullable <T> T put(@Nonnull ServiceKey<T> key, T service)
T
- Service type.key
- Service/resource key.service
- Service instance.null
.@Nullable <T> T putIfAbsent(@Nonnull ServiceKey<T> key, T service)
T
- Service type.key
- Service/resource key.service
- Service instance.null
.@Nullable default <T> T putIfAbsent(@Nonnull Class<T> type, T service)
T
- Service type.type
- Service/resource key.service
- Service instance.null
.@Nullable <T> T putIfAbsent(@Nonnull ServiceKey<T> key, javax.inject.Provider<T> service)
T
- Service type.key
- Service/resource key.service
- Service instance.null
.@Nullable default <T> T putIfAbsent(@Nonnull Class<T> type, javax.inject.Provider<T> service)
T
- Service type.type
- Service/resource key.service
- Service instance.null
.@Nonnull default <T> T require(@Nonnull Class<T> type)
Registry
@Nonnull default <T> T require(@Nonnull Class<T> type, @Nonnull String name)
Registry
@Nonnull default <T> T require(@Nonnull ServiceKey<T> key) throws RegistryException
Registry
require
in interface Registry
T
- Object type.key
- Object key.RegistryException
- If there was a runtime failure while providing an instance.Copyright © 2020. All rights reserved.