Package daikon.config
Class Configuration
- Object
-
- Configuration
-
- All Implemented Interfaces:
Serializable
public final class Configuration extends Object implements Serializable
This class applies settings from a configuration file that lists variable names and values (see "example-settings.txt" in this directory for an example). Multiple configuration files can be read, and the results can be re-written to a new configuration file.Important note: classes that have fields set via this Configuration (dkconfig) interface may not reference daikon.Global in their static initializers, since Global loads the default configuration, which classloads that class, and we would have a classloading circularity.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Configuration.ConfigException
Lets callers differentiate between configuration problems and all others.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply(@ClassGetName String classname, String fieldname, String value)
void
apply(InputStream input)
Apply the settings in the given InputStream.void
apply(Class<?> clazz, String fieldname, String value)
void
apply(String line)
Apply the setting in the given InputStream.void
apply(String name, String value)
Set the given setting to the given value.static Configuration
getInstance()
Returns the singleton instance of this class.void
overlap(Configuration config)
Take the settings given in the argument and call this.apply(String) for each of them.void
replay()
-
-
-
Method Detail
-
getInstance
public static Configuration getInstance()
Returns the singleton instance of this class.- Returns:
- the singleton instance of this class
-
replay
public void replay()
-
overlap
public void overlap(Configuration config)
Take the settings given in the argument and call this.apply(String) for each of them. This essentially overlaps the settings given in the argument over this (appending them to this in the process). This method is intended for loading a saved configuration from a file, since calling this method with the Configuration singleton makes no sense.
-
apply
public void apply(InputStream input)
Apply the settings in the given InputStream.- Parameters:
input
- the commands to set confiuration
-
apply
public void apply(String line)
Apply the setting in the given InputStream.- Parameters:
line
- the command to set confiuration
-
apply
public void apply(String name, String value)
Set the given setting to the given value.- Parameters:
name
- the setting to modifyvalue
- the setting's new value
-
-