public class Settings extends java.lang.Object
Constructor and Description |
---|
Settings(java.io.File settingsXmlFile) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
field(java.lang.String name) |
double |
fieldAsDouble(java.lang.String name) |
int |
fieldAsInt(java.lang.String name) |
java.lang.String |
getXml() |
void |
reload()
reloads the xml file
|
void |
save()
Saves the settings xml to disk (on the path provided to the constructor)
TODO: this is poorly done, we should save to a tmp file and then move the files
as opposed to just write on top of the old file
TODO: also, we should validate the xml
|
void |
setXml(java.lang.String xml)
Given an xml string (possibly from an editor), makes it the current settings and stores it in disk
|
public Settings(java.io.File settingsXmlFile) throws java.io.IOException
settingsXmlFile
- an xml file pointing to the settingsjava.io.IOException
public void setXml(java.lang.String xml) throws java.io.IOException
xml
- java.io.IOException
public final void reload() throws java.io.IOException
java.io.IOException
public void save() throws java.io.IOException
java.io.IOException
public java.lang.String getXml()
public java.lang.String field(java.lang.String name)
public int fieldAsInt(java.lang.String name)
public double fieldAsDouble(java.lang.String name)