org.psychomad.psycholib.resources
Class Config

java.lang.Object
  extended by org.psychomad.psycholib.resources.Config

public class Config
extends java.lang.Object

This class allow to use a config file in ReadOnly mode or Writable mode.

See Also:
Properties

Constructor Summary
Config(java.lang.String path, boolean modifAllowed)
          This constructor init the path to the config file, and make this config file read only or writable according to the parameter.
 
Method Summary
 double getDouble(java.lang.String str)
          Returns the double which corresponds to the given key.
 int getInt(java.lang.String str)
          Returns the int which corresponds to the given key.
 java.lang.String getPath()
           
 java.lang.String getString(java.lang.String str)
          Returns the string property which corresponds to the given key.
 java.lang.String getStringNoWarning(java.lang.String str)
           
 java.lang.Object setProperty(java.lang.String key, java.lang.String value)
          Make a call to the setPropety method of the Propeties class, in order to store the value in the resource file.
 void store()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Config

public Config(java.lang.String path,
              boolean modifAllowed)
This constructor init the path to the config file, and make this config file read only or writable according to the parameter.

Parameters:
path - the path to the config file.
modifAllowed - a boolean indicating if the config file is upgradable.
Method Detail

getPath

public java.lang.String getPath()
Returns:
the path associated with this config file.

getString

public java.lang.String getString(java.lang.String str)
                           throws MissingPropertiesException
Returns the string property which corresponds to the given key.

Parameters:
str - the string key
Returns:
the string property which corresponds to the given key
Throws:
MissingPropertiesException

getStringNoWarning

public java.lang.String getStringNoWarning(java.lang.String str)

getInt

public int getInt(java.lang.String str)
           throws MissingPropertiesException,
                  java.lang.NumberFormatException
Returns the int which corresponds to the given key.

Parameters:
str - the string key
Returns:
the int which corresponds to the given key.
Throws:
MissingPropertiesException
java.lang.NumberFormatException

getDouble

public double getDouble(java.lang.String str)
                 throws MissingPropertiesException,
                        java.lang.NumberFormatException
Returns the double which corresponds to the given key.

Parameters:
str - the string key
Returns:
the double which corresponds to the given key.
Throws:
MissingPropertiesException
java.lang.NumberFormatException

setProperty

public java.lang.Object setProperty(java.lang.String key,
                                    java.lang.String value)
Make a call to the setPropety method of the Propeties class, in order to store the value in the resource file. This method is no effect if the param 'modifAllowed' had been set to false.

See Also:
#java.util.Properties.setProperty

store

public void store()
           throws java.io.IOException
Throws:
java.io.IOException


Copyright 2006 null. All Rights Reserved.