ucar.unidata.util
Class Defaults

java.lang.Object
  extended by ucar.unidata.util.Defaults

public class Defaults
extends Object

The Defaults object is used by objects to store and retrieve various default settings.


Method Summary
static String getDefault(String key)
          Searches for the property with the specified key in the defaults list.
static String getDefault(String key, String defaultValue)
          Searches for the property with the specified key in the defaults list.
static Defaults getInstance()
          Method for accessing a Defaults object.
static Defaults initialize(String defaultsFile)
          Method for creating or reinitializing a Defaults object.
static Defaults initialize(URL defaultsFile)
          Method for creating or reinitializing a Defaults object.
 void printProperties()
          _more_
static void putDefault(String key, String value)
          Updates or adds a property to the defaults list.
static Defaults reset()
          Reset the defaults using the system defaults file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Defaults getInstance()
                            throws Exception
Method for accessing a Defaults object. Ensures only one exists. initialize or reset must be called first.

Returns:
a single instance of Defaults
Throws:
Exception
See Also:
initialize(java.net.URL), reset()

initialize

public static Defaults initialize(URL defaultsFile)
Method for creating or reinitializing a Defaults object. To load the system defaults, use Defaults.DEFAULTS_FILE as the filename or use reset method.

Parameters:
defaultsFile -
Returns:
a single instance of Defaults
See Also:
reset()

initialize

public static Defaults initialize(String defaultsFile)
Method for creating or reinitializing a Defaults object. To load the system defaults, use Defaults.DEFAULTS_FILE as the filename or use reset method.

Parameters:
defaultsFile -
Returns:
a single instance of Defaults
See Also:
reset()

reset

public static Defaults reset()
Reset the defaults using the system defaults file.

Returns:
a new defaults.

getDefault

public static String getDefault(String key)
Searches for the property with the specified key in the defaults list. If the key is not found in this list, the method returns null.

Parameters:
key - the defaults key.
Returns:
the value in the defaults list with the specified key value or null.

getDefault

public static String getDefault(String key,
                                String defaultValue)
Searches for the property with the specified key in the defaults list. If the key is not found in this list, the method returns the default value argument.

Parameters:
key - the defaults key.
defaultValue - the default value to return if the key does not exist
Returns:
the value in the defaults list with the specified key value or the defaultValue.

putDefault

public static void putDefault(String key,
                              String value)
Updates or adds a property to the defaults list. If the key does not exist, it is added to the list.

Parameters:
key - the defaults key to update or add
value - the value of the property

printProperties

public void printProperties()
_more_