Package ucar.unidata.util
Class Defaults
java.lang.Object
ucar.unidata.util.Defaults
The Defaults object is used by objects to store and retrieve
various default settings.
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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
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
_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.
-
Method Details
-
getInstance
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
Method for creating or reinitializing a Defaults object. To load the system defaults, use Defaults.DEFAULTS_FILE as the filename or usereset
method.- Parameters:
defaultsFile
-- Returns:
- a single instance of Defaults
- See Also:
-
initialize
Method for creating or reinitializing a Defaults object. To load the system defaults, use Defaults.DEFAULTS_FILE as the filename or usereset
method.- Parameters:
defaultsFile
-- Returns:
- a single instance of Defaults
- See Also:
-
reset
Reset the defaults using the system defaults file.- Returns:
- a new defaults.
-
getDefault
Searches for the property with the specified key in the defaults list. If the key is not found in this list, the method returnsnull
.- Parameters:
key
- the defaults key.- Returns:
- the value in the defaults list with the specified key value
or
null
.
-
getDefault
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
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 addvalue
- the value of the property
-
printProperties
public void printProperties()_more_
-