public class DefaultConfig extends AbstractConfig implements RepositoryChangeListener
| Constructor and Description |
|---|
DefaultConfig(String namespace,
ConfigRepository configRepository)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getProperty(String key,
String defaultValue)
Return the property value with the given key, or
defaultValue if the key doesn't exist. |
Set<String> |
getPropertyNames()
Return a set of the property names
|
ConfigSourceType |
getSourceType()
Return the config's source type, i.e.
|
void |
onRepositoryChange(String namespace,
Properties newProperties)
Invoked when config repository changes.
|
addChangeListener, addChangeListener, addChangeListener, getArrayProperty, getBooleanProperty, getByteProperty, getDateProperty, getDateProperty, getDateProperty, getDoubleProperty, getDurationProperty, getEnumProperty, getFloatProperty, getIntProperty, getLongProperty, getProperty, getShortProperty, removeChangeListenerpublic DefaultConfig(String namespace, ConfigRepository configRepository)
namespace - the namespace of this config instanceconfigRepository - the config repository for this config instancepublic String getProperty(String key, String defaultValue)
ConfigdefaultValue if the key doesn't exist.getProperty in interface Configkey - the property namedefaultValue - the default value when key is not found or any error occurredpublic Set<String> getPropertyNames()
ConfiggetPropertyNames in interface Configpublic ConfigSourceType getSourceType()
ConfiggetSourceType in interface Configpublic void onRepositoryChange(String namespace, Properties newProperties)
RepositoryChangeListeneronRepositoryChange in interface RepositoryChangeListenernamespace - the namespace of this repository changenewProperties - the properties after changeCopyright © 2022 Ctrip, Inc.. All rights reserved.