Config
, Serializable
public interface Reloadable extends Config
Allows a Config
object to implement the reloading of the properties at runtime.
Example:
public interface MyConfig extends Config, Reloadable { int someProperty(); } public void doSomething() { // loads the properties from the files for the first time. MyConfig cfg = ConfigFactory.create(MyConfig.class); int before = cfg.someProperty(); // after changing the local files... cfg.reload(); int after = cfg.someProperty(); // before and after may differ now. if (before != after) { ... } }
The reload method will reload the properties using the same sources used when it was instantiated the first time. This can be useful to programmatically reload the configuration after the configuration files were changed.
Config.ConverterClass, Config.DecryptorClass, Config.DefaultValue, Config.DisableableFeature, Config.DisableFeature, Config.EncryptedValue, Config.HotReload, Config.HotReloadType, Config.Key, Config.LoadPolicy, Config.LoadType, Config.PreprocessorClasses, Config.Separator, Config.Sources, Config.TokenizerClass
Modifier and Type | Method | Description |
---|---|---|
void |
addReloadListener(ReloadListener listener) |
Add a ReloadListener.
|
void |
reload() |
Reloads the properties using the same logic as when the object was instantiated by
ConfigFactory.create(Class, java.util.Map[]) . |
void |
removeReloadListener(ReloadListener listener) |
Remove a ReloadListener.
|
void reload()
ConfigFactory.create(Class, java.util.Map[])
.void addReloadListener(ReloadListener listener)
listener
- the listener to be addedvoid removeReloadListener(ReloadListener listener)
listener
- the listener to be removedCopyright © 2012–2020 Luigi R. Viggiano. All rights reserved.