Class RememberHelper

java.lang.Object
be.gaudry.model.config.RememberHelper

public class RememberHelper extends Object
Allows to save some property into a property file or in a system setting (roaming) Provided by the broldev.core.model project.
Since:
1.0 Sep 10, 2008, broldev.core.model 0.0.1-SNAPSHOT dependency
Version:
1.1 Sep 12, 2008
Author:
Steph GAUDRY
See Also:
PropertiesHelper
  • Method Details

    • getInstance

      public static RememberHelper getInstance()
      See the logging information to know how the logging is implemented.
      Returns:
      a unique instance of RememberHelper
    • getComments

      public String getComments()
      Comments to put on the top of the property file.
      Returns:
      the comments
    • setComments

      public void setComments(String comments)
      Parameters:
      comments - the comments to set
      See Also:
      getComments()
    • saveProperties

      public boolean saveProperties()
      Saves the property file in the selected path See the logging information to know how the logging is implemented.
      Returns:
      true if the properties have been saved.
    • loadProperties

      public void loadProperties()
      Reads a property file at the selected location. In case of FileNotFoundException or IOException, creates an empty Properties. See the logging information to know how the logging is implemented.
    • clean

      public void clean()
      Deletes preferences (which are stored in the registry if the operating system is Windows), and properties (a file stored in the application directory)
    • debugProperties

      public void debugProperties(Properties props)
      Outputs each key/value pair on the logger with a debug level See the logging information to know how the logging is implemented.
      Parameters:
      props -
    • debugPreferences

      public void debugPreferences(Preferences p)
    • debug

      public static void debug()
    • debug

      public static void debug(String info)
    • setProperty

      public static String setProperty(String key, String value, RememberHelper.StorageType storageType)
      Sets a value to a property. See the logging information to know how the logging is implemented.
      Parameters:
      key - the key to be placed into this property list (uses slashes as separator, like broldev/view/myprop).
      value - the value corresponding to key.
      storageType - where to set the value
      Returns:
      the previous value of the specified key in this property list, or null if it did not have one.
    • setProperty

      public static String setProperty(String key, boolean value, RememberHelper.StorageType storageType)
      Parameters:
      key -
      value -
      storageType -
      Returns:
      See Also:
      setPathProperty(String, String, StorageType)
    • getProperty

      public static boolean getProperty(String key, boolean defaultValue, RememberHelper.StorageType storageType)
      Parameters:
      key -
      defaultValue -
      storageType -
      Returns:
      See Also:
      getPathProperty(String, String, StorageType)
    • getProperty

      public static String getProperty(String key, String defaultValue, RememberHelper.StorageType storageType)
      Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns the defaultValue if the property is not found. See the logging information to know how the logging is implemented.
      Parameters:
      key - the property key (uses slashes as separator, like broldev/view/myprop).
      defaultValue - return value if the key is not found
      storageType - where to get the value
      Returns:
      the value in this property list with the specified key value.
      See Also:
      setProperty(String, String, StorageType)
    • isNewConfig

      public static boolean isNewConfig()
    • getPathProperty

      public static String getPathProperty(String key, String defaultValue, RememberHelper.StorageType storageType)
    • setPathProperty

      public static String setPathProperty(String key, String value, RememberHelper.StorageType storageType)