Package org.sonews.config
Klasse FileConfig
java.lang.Object
org.sonews.config.AbstractConfig
org.sonews.config.FileConfig
Manages the bootstrap configuration. It MUST contain all config values that
are needed to establish a database connection. For further configuration
values use the Config class instead as that class stores its values within
the database.
- Seit:
- sonews/0.5.0
- Autor:
- Christian Lins
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungprivate static final Propertiesprivate static FileConfigprivate final org.slf4j.Loggerprivate final Properties -
Konstruktorübersicht
KonstruktorenModifiziererKonstruktorBeschreibungprivateConfig is a singelton class with only one instance at time. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungReturns the value that is stored within this config identified by the given key.static FileConfigfinal voidload()Loads the configuration from the config file.voidsave()Saves this Config to the config file.voidSets the value for a given key.Von Klasse geerbte Methoden org.sonews.config.AbstractConfig
get, get, get
-
Felddetails
-
defaultConfig
-
instance
-
settings
-
log
private final org.slf4j.Logger log
-
-
Konstruktordetails
-
FileConfig
private FileConfig()Config is a singelton class with only one instance at time. So the constructor is private to prevent the creation of more then one Config instance.
-
-
Methodendetails
-
getInstance
-
load
Loads the configuration from the config file. By default this is done by the (private) constructor but it can be useful to reload the config by invoking this method.- Löst aus:
IOException
-
save
Saves this Config to the config file. By default this is done at program end.- Löst aus:
FileNotFoundExceptionIOException
-
get
Returns the value that is stored within this config identified by the given key. If the key cannot be found the default value is returned.- Angegeben von:
getin KlasseAbstractConfig- Parameter:
key- Key to identify the value.def- The default value that is returned if the key is not found in this Config.- Gibt zurück:
-
set
Sets the value for a given key.- Angegeben von:
setin KlasseAbstractConfig- Parameter:
key-value-
-