PropertyMap¶
-
public class
PropertyMap
extends PersistentComponent implements PropertySheet¶ PropertyMap is an implementation of a PropertySheet. It represents a property sheet with a map structure and is actually backed by a Properties object.
Author: Hugo Y. K. Lam See also:
java.util.Properties
Constructors¶
PropertyMap¶
-
public
PropertyMap
(Properties p)¶ Creates a new instance of PropertyMap.
Parameters: - p – the Properties object which backs this map.
Methods¶
append¶
-
public boolean
append
(PropertySheet p)¶ Appends a property sheet to this property map. The specified property sheet can only be appended if it is of the PropertyMap type.
Parameters: - p – the property sheet to be appended.
Returns: true if the operation is successful. false otherwise.
See also:
hk.hku.cecid.piazza.commons.util.PropertySheet.append(hk.hku.cecid.piazza.commons.util.PropertySheet)
containsKey¶
createProperties¶
-
public Properties
createProperties
(String keyPrefix)¶ Creates a Properties object which stores the properties retrieved by the specified key prefix.
Parameters: - keyPrefix – the property key prefix.
Returns: a Properties object which stores the retrieved properties.
See also:
hk.hku.cecid.piazza.commons.util.PropertySheet.createProperties(java.lang.String)
getProperties¶
getProperties¶
-
public String[][]
getProperties
(String keyPrefix, String keySuffixes)¶ Gets a two-dimensional list of properties with the specified key prefix and key suffixes. The key prefix, along with the suffixes, will define the first dimension of the list while the key suffixes will define the second dimension. E.g.
# Properties content application.listener1.id=MyListener application.listener1.name=My Listener application.listener2.id=MyListener2 application.listener2.name=My Listener 2 Key Prefix: application.listener Key Suffixes: id,name Note that the resulted array will be sorted alphabetically according to the original keys but not the specified key suffixes order or the property values. Returned array: {{"MyListener","My Listener"},{"MyListener2","My Listener 2"}}
Parameters: - keyPrefix – the property key prefix.
- keySuffixes – the property key suffixes delimited by either ‘,’, ‘;’ or ‘|’.
Returns: a two-dimensional list of properties with the specified keys.
See also:
hk.hku.cecid.piazza.commons.util.PropertySheet.getProperties(java.lang.String, java.lang.String)
getProperty¶
getProperty¶
-
public String
getProperty
(String key, String def)¶ Gets a property with the specified key.
Parameters: - key – the property key.
- def – the default value.
Returns: the property with the specified key.
See also:
hk.hku.cecid.piazza.commons.util.PropertySheet.getProperty(java.lang.String, java.lang.String)
getPropertyNames¶
loading¶
propertyNames¶
-
public Enumeration
propertyNames
()¶ Gets all the existing property names.
Returns: all the existing property names. See also:
hk.hku.cecid.piazza.commons.util.PropertySheet.propertyNames()
removeProperty¶
setProperty¶
-
public boolean
setProperty
(String key, String value)¶ Sets a property value with the specified key.
Parameters: - key – the property key.
- value – the property value.
Returns: true if the operation is successful. false otherwise.
See also:
hk.hku.cecid.piazza.commons.util.PropertySheet.setProperty(java.lang.String, java.lang.String)