com.resilientedge.util.prefs
Class ContextPrefs
java.lang.Object
|
+--com.resilientedge.util.prefs.Prefs
|
+--com.resilientedge.util.prefs.ContextPrefs
- public class ContextPrefs
- extends Prefs
Preferences is used to get application configuration parameters.
Preferences supplied several methods to handle type conversion of the
parameter requested. A default parameter may also be supplied for cases
where the parameter requested is not found or there is some other error.
Missing parameters and type conversion failures will throw a
PreferencesException except where a default is supplied in which case the
default will be returned.
Call getInstance() to get an instance of Preferences.
Example:
String myValue = Preferences.getInstance().getValueAsString("user.email.address");
This class requires a Context to be bound to the ApplicationCtx called
"preference".
- Author:
- jgardner
Constructor Summary |
ContextPrefs()
Use getInstance() to get an instance. |
ContextPrefs(javax.naming.Context ctx)
Use getInstance() to get an instance. |
Method Summary |
java.lang.String |
getString(java.lang.String name,
java.lang.String def)
|
void |
setString(java.lang.String name,
java.lang.String value)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ContextPrefs
public ContextPrefs()
- Use getInstance() to get an instance.
ContextPrefs
public ContextPrefs(javax.naming.Context ctx)
- Use getInstance() to get an instance.
- Parameters:
ctx
- Parameter Description
setString
public void setString(java.lang.String name,
java.lang.String value)
- Overrides:
setString
in class Prefs
- Parameters:
name
- The new String valuevalue
- The new String value
getString
public java.lang.String getString(java.lang.String name,
java.lang.String def)
- Overrides:
getString
in class Prefs
- Parameters:
name
- Parameter Descriptiondef
- Parameter Description- Returns:
- The String value
Copyright © 2001 Resilient Edge, Inc. All Rights Reserved.