public class SetSettings
extends java.lang.Object
Settings
for further
details of how settings are structured.Constructor and Description |
---|
SetSettings()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
addSetting(java.lang.String setting,
java.lang.String value)
Adds a new root level setting
|
boolean |
addSetting(java.lang.String group,
java.lang.String setting,
java.lang.String value)
Adds a new setting within a group
|
static SetSettings |
fromFile(java.io.File f)
Reads settings from a file and returns an instance of this class.
|
static SetSettings |
fromFileAndCommandLine(java.io.File f,
java.lang.String[] c)
Returns settings from a file and the command line and returns an instance
of this class.
|
java.util.Set<java.lang.String> |
getGroups()
Gets the set of all groups that have had a setting set within them
|
java.util.Set<java.lang.String> |
getSet()
Gets the set of root level settings that have been set
|
java.util.Set<java.lang.String> |
getSet(java.lang.String group)
Gets the set of settings that have been set within a group
|
java.lang.String |
getSetting(java.lang.String setting)
Gets the value of a root level setting
|
java.lang.String |
getSetting(java.lang.String group,
java.lang.String setting)
Gets the value of a setting within a group
|
boolean |
isSet(java.lang.String setting)
Tests whether a root level setting has been set
|
boolean |
isSet(java.lang.String group,
java.lang.String setting)
Tests whether a setting within a groups has been set
|
java.lang.String |
toString() |
public boolean addSetting(java.lang.String setting, java.lang.String value)
setting
- The setting namevalue
- The value to set the setting topublic boolean addSetting(java.lang.String group, java.lang.String setting, java.lang.String value)
group
- The group namesetting
- The setting namevalue
- The value to set the setting topublic java.lang.String getSetting(java.lang.String setting)
setting
- The setting's namepublic java.lang.String getSetting(java.lang.String group, java.lang.String setting)
group
- The group's namesetting
- The setting's namepublic java.util.Set<java.lang.String> getGroups()
public java.util.Set<java.lang.String> getSet()
public java.util.Set<java.lang.String> getSet(java.lang.String group)
group
- The group's namepublic boolean isSet(java.lang.String setting)
setting
- The setting's namepublic boolean isSet(java.lang.String group, java.lang.String setting)
group
- The group's namesetting
- The setting's anmepublic java.lang.String toString()
toString
in class java.lang.Object
public static SetSettings fromFile(java.io.File f) throws java.io.FileNotFoundException, java.io.IOException, SettingException
f
- The file namejava.io.FileNotFoundException
- If the settings file is not foundjava.io.IOException
- If there is a problem reading from the settings fileSettingException
- If there is a line in an unexpected formatpublic static SetSettings fromFileAndCommandLine(java.io.File f, java.lang.String[] c) throws java.io.FileNotFoundException, java.io.IOException, SettingException
fromFile(java.io.File)
for file format. If
the value of a setting contains $i (where i is an integer) then it is
replaced by the ith element of c.f
- The settings file namec
- An array of command line inputsjava.io.FileNotFoundException
- If the settings file is not foundjava.io.IOException
- If there is a problem reading from the settings fileSettingException
- If there is a line in an unexpected format