Class StandardConfigHandler
java.lang.Object
rs.edu.raf.dsw.rudok.app.observer.IObserver
rs.edu.raf.dsw.rudok.app.observer.IPublisherGlobal
rs.edu.raf.dsw.rudok.app.observer.IPublisher
rs.edu.raf.dsw.rudok.app.confighandler.standard.StandardConfigHandler
- All Implemented Interfaces:
IConfigHandler
public class StandardConfigHandler extends IPublisher implements IConfigHandler
Standard config handler
Standard (default) implementation of the IConfigHandler component.-
Nested Class Summary
Nested classes/interfaces inherited from interface rs.edu.raf.dsw.rudok.app.confighandler.IConfigHandler
IConfigHandler.Message -
Constructor Summary
Constructors Constructor Description StandardConfigHandler(ApplicationFramework applicationFramework) -
Method Summary
Modifier and Type Method Description voidcreateConfig(String name)Sets up a new configuration in program and in memory.Objectget(String key)Returns the configuration value for the given key.Objectget(String key, Object defaultValue)Returns the configuration value for the given key, or default value if key not set.booleanloadConfig(String name)Loads the configuration file from the given URI.voidresetConfig()Loads the default config.voidsaveConfig()Saves the current configuration.voidset(String key, String val)Sets the configuration value for the given key.Methods inherited from class rs.edu.raf.dsw.rudok.app.observer.IPublisher
addObserver, getObservers, publish, removeObserver, setObserversMethods inherited from class rs.edu.raf.dsw.rudok.app.observer.IPublisherGlobal
addObserverGlobal, getObserversGlobal, removeObserverGlobalMethods inherited from class rs.edu.raf.dsw.rudok.app.observer.IObserver
addPublisher, getPublishers, receive, removePublisher, setPublishersMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface rs.edu.raf.dsw.rudok.app.confighandler.IConfigHandler
getOrDefault, loadConfig
-
Constructor Details
-
StandardConfigHandler
-
-
Method Details
-
loadConfig
Description copied from interface:IConfigHandlerLoads the configuration file from the given URI. Returns true if successful, false otherwise.- Specified by:
loadConfigin interfaceIConfigHandler- Parameters:
name- Config name.- Returns:
- True if loaded, false otherwise.
-
resetConfig
public void resetConfig()Description copied from interface:IConfigHandlerLoads the default config.- Specified by:
resetConfigin interfaceIConfigHandler
-
saveConfig
public void saveConfig()Description copied from interface:IConfigHandlerSaves the current configuration.- Specified by:
saveConfigin interfaceIConfigHandler
-
set
Description copied from interface:IConfigHandlerSets the configuration value for the given key.- Specified by:
setin interfaceIConfigHandler- Parameters:
key- Config key.val- Value to set.
-
get
Description copied from interface:IConfigHandlerReturns the configuration value for the given key.- Specified by:
getin interfaceIConfigHandler- Parameters:
key- Config key.- Returns:
- Value if set, otherwise null.
-
get
Description copied from interface:IConfigHandlerReturns the configuration value for the given key, or default value if key not set.- Specified by:
getin interfaceIConfigHandler- Parameters:
key- Config key.defaultValue- Default value to return if config key not set.- Returns:
- Value if set, otherwise defaultValue.
-
createConfig
Description copied from interface:IConfigHandlerSets up a new configuration in program and in memory.- Specified by:
createConfigin interfaceIConfigHandler- Parameters:
name- New configuration name.
-