public class ConfigurationServiceImpl extends Object implements ConfigurationService, ServiceRegistryAwareService
ConfigurationService.Converter<T>
Constructor and Description |
---|
ConfigurationServiceImpl(Map settings)
Constructs a ConfigurationServiceImpl
|
Modifier and Type | Method and Description |
---|---|
<T> T |
cast(Class<T> expected,
Object candidate)
Cast candidate to the instance of expected type.
|
<T> T |
getSetting(String name,
Class<T> expected,
T defaultValue)
Get the named setting.
|
<T> T |
getSetting(String name,
ConfigurationService.Converter<T> converter)
Get the named setting, using the specified converter.
|
<T> T |
getSetting(String name,
ConfigurationService.Converter<T> converter,
T defaultValue)
Get the named setting, using the specified converter and default value.
|
Map |
getSettings()
Access to the complete map of config settings.
|
void |
injectServices(ServiceRegistryImplementor serviceRegistry)
Callback to inject the registry.
|
public ConfigurationServiceImpl(Map settings)
settings
- The map of settingspublic Map getSettings()
ConfigurationService
getSettings
in interface ConfigurationService
public void injectServices(ServiceRegistryImplementor serviceRegistry)
ServiceRegistryAwareService
injectServices
in interface ServiceRegistryAwareService
serviceRegistry
- The registrypublic <T> T getSetting(String name, ConfigurationService.Converter<T> converter)
ConfigurationService
getSetting
in interface ConfigurationService
T
- The Java type of the conversionname
- The name of the setting to get.converter
- The converter to applynull
(see ConfigurationService.getSetting(String, Class, Object)
)public <T> T getSetting(String name, ConfigurationService.Converter<T> converter, T defaultValue)
ConfigurationService
getSetting
in interface ConfigurationService
T
- The Java type of the conversionname
- The name of the setting to get.converter
- The converter to applydefaultValue
- If no setting with that name is found, return this default value as the result.public <T> T getSetting(String name, Class<T> expected, T defaultValue)
ConfigurationService
getSetting
in interface ConfigurationService
T
- The Java type of the conversionname
- The name of the setting to get.expected
- The expected Java type.defaultValue
- If no setting with that name is found, return this default value as the result.public <T> T cast(Class<T> expected, Object candidate)
ConfigurationService
cast
in interface ConfigurationService
T
- The java type of the expected returnexpected
- The type of instance expected to return.candidate
- The candidate object to be casted.Copyright © 2019 JBoss by Red Hat. All rights reserved.