Package com.portal.bas
Class PPropUtilities
java.lang.Object
com.portal.bas.PPropUtilities
Utility class to deal with client default properties and user preferences
that may override the client defaults. Looking up a key using these
methods will first attempt to retrieve the key from the client defaults
(PClientContext.getServices().getDefaultProperties()) and then attempt to
retrieve the same key from the user prefs
(PClientContext.getServices().getUserPreferences()). If set in the user
prefs that value will be returned. If not set in user prefs the value
from the client defaults (if any) will be returned.
You can also register for changes to the user preferences via methods in this class. The caveat is that only changes made via the setProp() method will be tracked.
You can also register for changes to the user preferences via methods in this class. The caveat is that only changes made via the setProp() method will be tracked.
- Version:
- %version: 4 % %date_modified: Thu Sep 27 11:47:58 2001 %
- Author:
- kapono
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Register for changes to the user preferences.static boolean
getBooleanProp
(String key) Retrieve the boolean value for the given key name from the properties object.static int
getIntProp
(String key) Retrieve the integer value for the given key name from the properties object.static String
getStringProp
(String key) Retrieve the String value for the given key name from the properties object.static Properties
mergeProperties
(Properties p1, Properties p2) Combines all the elements of two properties objects into one and returns a new properties object.static void
Unregister for changes to the user preferences.static void
Stores the given key/value pair in both the client default property object and the user preferences object
-
Constructor Details
-
PPropUtilities
public PPropUtilities()
-
-
Method Details
-
getIntProp
Retrieve the integer value for the given key name from the properties object. If the value is not found, return -1;- Parameters:
String
- the key name- Returns:
- the int value
-
getStringProp
Retrieve the String value for the given key name from the properties object.- Parameters:
String
- the key name- Returns:
- the property value
-
getBooleanProp
Retrieve the boolean value for the given key name from the properties object.- Parameters:
key
- the property key name- Returns:
- the boolean value or false if the key is not contained in the properties object
-
setProp
Stores the given key/value pair in both the client default property object and the user preferences object- Parameters:
key
- the property key namevalue
- the property value
-
mergeProperties
Combines all the elements of two properties objects into one and returns a new properties object. If there are common elements in the given properties objects, then the value objtained from the second properties object will overwrite the value in the first properties object.- Parameters:
p1
- Properties object to use as a defaultp2
- Properties object to add/merge to p1- Returns:
- A new properties object
-
addPropertyChangeListener
Register for changes to the user preferences. Note that only changes made through the setProp() method in this class will be tracked.- Parameters:
l
-
-
removePropertyChangeListener
Unregister for changes to the user preferences.- Parameters:
l
-
-