org.acm.seguin.ide.common.options
Class PropertiesFile

java.lang.Object
  extended by org.acm.seguin.ide.common.options.PropertiesFile

public class PropertiesFile
extends java.lang.Object

An extension to org.acm.seguin.util.FileSettings with methods for storing and saving new properties.

Since:
1.0
Version:
$Version: $
Author:
Mike Atkinson ( Mike@ladyshot.demon.co.uk ), Dirk Moebius (dmoebius@gmx.net )

Constructor Summary
PropertiesFile(FileSettings props)
          initializes the properties with the settings of a FileSettings instance.
 
Method Summary
 void deleteKey(java.lang.String key)
          Description of the Method
 boolean getBoolean(java.lang.String key)
           
 boolean getBoolean(java.lang.String key, boolean defaultValue)
           
 int getInteger(java.lang.String key, int defaultValue)
           
 java.lang.String getString(java.lang.String key)
           
 java.lang.String getString(java.lang.String key, java.lang.String defaultValue)
           
 boolean isLocalProperty(java.lang.String key)
          Gets the localProperty attribute of the PropertiesFile object
 void save()
          Reloads the original property file, overrides the old values with the stored new ones, and saves the property file, if there are any changes.
 void save(java.io.File file)
          Reloads the original property file, overrides the old values with the stored new ones, and saves the property file, if there are any changes.
 void setString(java.lang.String key, java.lang.String value)
          Sets the string attribute of the PropertiesFile object
 java.lang.String toString()
          Description of the Method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertiesFile

public PropertiesFile(FileSettings props)
initializes the properties with the settings of a FileSettings instance.

Parameters:
props - Description of the Parameter
Method Detail

isLocalProperty

public boolean isLocalProperty(java.lang.String key)
Gets the localProperty attribute of the PropertiesFile object

Parameters:
key - Description of the Parameter
Returns:
The localProperty value

getString

public java.lang.String getString(java.lang.String key)
Parameters:
key - the property key
Returns:
the value of the property as String, or null if the property cannot be found.

getString

public java.lang.String getString(java.lang.String key,
                                  java.lang.String defaultValue)
Parameters:
key - the property key
defaultValue - a default value
Returns:
the value of the property as String, or the default value if the property cannot be found.

getInteger

public int getInteger(java.lang.String key,
                      int defaultValue)
Parameters:
key - the property key
defaultValue - a default value
Returns:
the value of the property as int, or the defaultValue if either the property cannot be found, or the stored property is not a valid integer.

getBoolean

public boolean getBoolean(java.lang.String key)
Parameters:
key - the property key
Returns:
true, if the value of the property equals "true", false otherwise

getBoolean

public boolean getBoolean(java.lang.String key,
                          boolean defaultValue)
Parameters:
key - the property key
defaultValue - Description of the Parameter
Returns:
true, if the value of the property equals "true", false otherwise

setString

public void setString(java.lang.String key,
                      java.lang.String value)
Sets the string attribute of the PropertiesFile object

Parameters:
key - The new string value
value - The new string value

deleteKey

public void deleteKey(java.lang.String key)
Description of the Method

Parameters:
key - Description of the Parameter

save

public void save()
Reloads the original property file, overrides the old values with the stored new ones, and saves the property file, if there are any changes.


toString

public java.lang.String toString()
Description of the Method

Overrides:
toString in class java.lang.Object
Returns:
Description of the Return Value

save

public void save(java.io.File file)
          throws java.io.IOException
Reloads the original property file, overrides the old values with the stored new ones, and saves the property file, if there are any changes.

Parameters:
file - Description of the Parameter
Throws:
java.io.IOException - Description of the Exception