Package be.gaudry.model.config
Class RememberHelper
java.lang.Object
be.gaudry.model.config.RememberHelper
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSave/Load preferences behavior (local storage or roaming) -
Method Summary
Modifier and TypeMethodDescriptionvoidclean()Deletes preferences (which are stored in the registry if the operating system is Windows), and properties (a file stored in the application directory)static voiddebug()static voidvoidvoiddebugProperties(Properties props)Outputs each key/value pair on the logger with a debug level See thelogging informationto know how the logging is implemented.Comments to put on the top of the property file.static RememberHelperSee thelogging informationto know how the logging is implemented.static StringgetPathProperty(String key, String defaultValue, RememberHelper.StorageType storageType)static booleangetProperty(String key, boolean defaultValue, RememberHelper.StorageType storageType)static StringgetProperty(String key, String defaultValue, RememberHelper.StorageType storageType)Searches for the property with the specified key in this property list.static booleanvoidReads a property file at the selected location.booleanSaves the property file in the selected path See thelogging informationto know how the logging is implemented.voidsetComments(String comments)static StringsetPathProperty(String key, String value, RememberHelper.StorageType storageType)static StringsetProperty(String key, boolean value, RememberHelper.StorageType storageType)static StringsetProperty(String key, String value, RememberHelper.StorageType storageType)Sets a value to a property.
-
Method Details
-
getInstance
See thelogging informationto know how the logging is implemented.- Returns:
- a unique instance of
RememberHelper
-
getComments
Comments to put on the top of the property file.- Returns:
- the comments
-
setComments
- Parameters:
comments- the comments to set- See Also:
getComments()
-
saveProperties
public boolean saveProperties()Saves the property file in the selected path See thelogging informationto 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 ofFileNotFoundExceptionorIOException, creates an emptyProperties. See thelogging informationto 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
Outputs each key/value pair on the logger with a debug level See thelogging informationto know how the logging is implemented.- Parameters:
props-
-
debugPreferences
-
debug
public static void debug() -
debug
-
setProperty
Sets a value to a property. See thelogging informationto 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
nullif 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 thelogging informationto 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 foundstorageType- 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)
-