nl.madline.opendp500
Class JDPConfig

java.lang.Object
  |
  +--nl.madline.opendp500.JDPConfig

public class JDPConfig
extends java.lang.Object

This is a representation of the configuration file. Methods are created to get/set options and save the file to disk

Author:
svmaris

Constructor Summary
JDPConfig(java.io.File f)
          Default contructor
 
Method Summary
 java.io.File getConfigFile()
           
 java.util.Properties getProperties()
          Return the current configuration as a Properties object
 java.lang.String getProperty(java.lang.String property)
          Return the value of a given property in the configuration
 void save()
          Save the current configuration from memory to disk, using the filename this object was created with.
 void setProperty(java.lang.String name, java.lang.String value)
          Set a property in the configuration to 'value'.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDPConfig

public JDPConfig(java.io.File f)
Default contructor

Parameters:
f - The configuration file as a File-object
Method Detail

setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)
Set a property in the configuration to 'value'. Please note that the changes are not written to disk yet. You will have to call save() to do that.

Parameters:
name - The variable name in the configuration file
value - The new value of the setting

getProperties

public java.util.Properties getProperties()
Return the current configuration as a Properties object

Returns:
properties All configuration options and their values as a Properties object

getProperty

public java.lang.String getProperty(java.lang.String property)
Return the value of a given property in the configuration

Parameters:
property - The name of the property
Returns:
property The value of the property

save

public void save()
Save the current configuration from memory to disk, using the filename this object was created with. I built it so that the formatting of the original configuration file will stay intact (comments, order of configuration items, etc). Only the changed properties will be replaced.


getConfigFile

public java.io.File getConfigFile()
Returns:
file The configuration-file as a File-object