T
- represents type of a configuration item (allowed types are determined by configuration service)public class ConfigurationItemImpl<T extends Serializable> extends Object implements ConfigurationItem<T>
ConfigurationItem
.Constructor and Description |
---|
ConfigurationItemImpl(Class<T> clazz,
String key,
ConfigurationService configurationService)
Default all-args constructor to create
wrapper . |
Modifier and Type | Method and Description |
---|---|
T |
getValue()
Gets required configuration item.
|
T |
getValue(T defaultValue)
Gets configuration item and specifies a default value in case configuration item is not found.
|
void |
setValue(T newValue)
Sets a new value for the configuration item.
|
String |
toString() |
public ConfigurationItemImpl(Class<T> clazz, String key, ConfigurationService configurationService)
wrapper
.clazz
- this represents the wrapped type class; it has to be specified here as due to type
erasure mechanisms in java generics, it
cannot be inferred in runtime from declared type parameterkey
- represents identification of configured item in configuration storage/serviceconfigurationService
- to operate with ConfigurationItem
public T getValue() throws ConfigurationException
ConfigurationItem
getValue
in interface ConfigurationItem<T extends Serializable>
ConfigurationException
- When configuration item is not found in the repository
(i.e. application requires to have this configuration item)public T getValue(T defaultValue)
ConfigurationItem
getValue
in interface ConfigurationItem<T extends Serializable>
defaultValue
- as default value for itemdefaultValue
in case item
is not found in repositorypublic void setValue(T newValue)
ConfigurationItem
setValue
in interface ConfigurationItem<T extends Serializable>
newValue
- for configuration itemCopyright © 2018 Pivotal Software, Inc.. All rights reserved.