Class PPropUtilities

java.lang.Object
com.portal.bas.PPropUtilities

public class PPropUtilities extends Object
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.
Version:
%version: 4 % %date_modified: Thu Sep 27 11:47:58 2001 %
Author:
kapono
  • Constructor Details

    • PPropUtilities

      public PPropUtilities()
  • Method Details

    • getIntProp

      public static int getIntProp(String key)
      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

      public static String getStringProp(String key)
      Retrieve the String value for the given key name from the properties object.
      Parameters:
      String - the key name
      Returns:
      the property value
    • getBooleanProp

      public static boolean getBooleanProp(String key)
      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

      public static void setProp(String key, String value)
      Stores the given key/value pair in both the client default property object and the user preferences object
      Parameters:
      key - the property key name
      value - the property value
    • mergeProperties

      public static Properties mergeProperties(Properties p1, Properties p2)
      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 default
      p2 - Properties object to add/merge to p1
      Returns:
      A new properties object
    • addPropertyChangeListener

      public static void addPropertyChangeListener(PropertyChangeListener l)
      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

      public static void removePropertyChangeListener(PropertyChangeListener l)
      Unregister for changes to the user preferences.
      Parameters:
      l -