|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.Dictionary java.util.Hashtable java.util.Properties org.jboss.util.property.PropertyMap
A replacement for the standard java.util.Properties
class which adds, among others, property event capabilities.
Field Summary | |
protected Map |
boundListeners
Bound property name -> listener list map |
static String[] |
EMPTY_ARRAY_PROPERTY
Empty array property |
static String |
PROPERTY_NAME_SEPARATOR
Property name separator |
protected List |
unboundListeners
Property listener list |
Fields inherited from class java.util.Properties |
defaults |
Constructor Summary | |
PropertyMap()
Construct a PropertyMap. |
|
PropertyMap(Properties defaults)
Construct a PropertyMap with default properties. |
Method Summary | |
protected void |
addPropertyListener(BoundPropertyListener listener)
Add a bound property listener. |
void |
addPropertyListener(PropertyListener listener)
Add a property listener. |
void |
addPropertyListeners(PropertyListener[] listeners)
Add an array of property listeners. |
boolean |
containsProperty(String name)
Check if this map contains a given property. |
Set |
entrySet(boolean includeDefaults)
Returns a set of entrys for all entries in this group and optionally all of the entrys in the defaults map. |
protected void |
firePropertyAdded(PropertyEvent event)
Fire a property added event to all registered listeners. |
protected void |
firePropertyChanged(PropertyEvent event)
Fire a property changed event to all listeners. |
protected void |
firePropertyRemoved(PropertyEvent event)
Fire a property removed event to all registered listeners. |
String[] |
getArrayProperty(String name)
Get an array style property. |
String[] |
getArrayProperty(String base,
String[] defaultValues)
Get an array style property. |
String |
getProperty(String name)
|
PropertyGroup |
getPropertyGroup(String basename)
Get a property group for the given property base. |
PropertyGroup |
getPropertyGroup(String basename,
int index)
Get a property group for the given property base at the given index. |
Set |
keySet(boolean includeDefaults)
Returns a set of keys for all entries in this group and optionally all of the keys in the defaults map. |
void |
load(Map map)
Load properties from a map. |
void |
load(PropertyReader reader)
Load properties from a PropertyReader. |
void |
load(String className)
Load properties from a PropertyReader specifed by the given class name. |
void |
load(String prefix,
Map map)
Load properties from a map. |
protected String |
makeIndexPropertyName(String base,
int index)
Make an indexed property name. |
protected String |
makePrefixedPropertyName(String base,
String prefix)
Make a optionaly prefixed property name. |
Iterator |
names()
Return an iterator over all contained property names. |
Object |
put(Object name,
Object value)
Set a property. |
Object |
remove(Object name)
Remove a property. |
String |
removeProperty(String name)
Remove a property. |
protected boolean |
removePropertyListener(BoundPropertyListener listener)
Remove a bound property listener. |
boolean |
removePropertyListener(PropertyListener listener)
Remove a property listener. |
Object |
setProperty(String name,
String value)
Set a property. |
Methods inherited from class java.util.Properties |
getProperty, list, list, load, propertyNames, save, store |
Methods inherited from class java.util.Hashtable |
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, putAll, rehash, size, toString, values |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String PROPERTY_NAME_SEPARATOR
public static final String[] EMPTY_ARRAY_PROPERTY
protected transient List unboundListeners
protected transient Map boundListeners
Constructor Detail |
public PropertyMap(Properties defaults)
defaults
- Default properties.public PropertyMap()
Method Detail |
public Object put(Object name, Object value)
name
- Property name.value
- Property value.
public Object remove(Object name)
name
- Property name.
public Set keySet(boolean includeDefaults)
public Set entrySet(boolean includeDefaults)
public void addPropertyListener(PropertyListener listener)
listener
- Property listener to add.protected void addPropertyListener(BoundPropertyListener listener)
listener
- Bound property listener to add.public void addPropertyListeners(PropertyListener[] listeners)
listeners
- Array of property listeners to add.public boolean removePropertyListener(PropertyListener listener)
listener
- Property listener to remove.
protected boolean removePropertyListener(BoundPropertyListener listener)
listener
- Bound property listener to remove.
protected void firePropertyAdded(PropertyEvent event)
event
- Property event.protected void firePropertyRemoved(PropertyEvent event)
event
- Property event.protected void firePropertyChanged(PropertyEvent event)
event
- Property event.protected String makePrefixedPropertyName(String base, String prefix)
base
- Base property name.prefix
- Optional prefix (can be null).
public void load(String prefix, Map map) throws PropertyException
prefix
- Prefix to append to all map keys (or null).map
- Map containing properties to load.
PropertyException
public void load(Map map) throws PropertyException
map
- Map containing properties to load.
PropertyException
public void load(PropertyReader reader) throws PropertyException, IOException
reader
- PropertyReader to read properties from.
PropertyException
IOException
public void load(String className) throws PropertyException, IOException
className
- Class name of a PropertyReader to read from.
PropertyException
IOException
public Object setProperty(String name, String value)
Returns Object instead of String due to limitations with
java.util.Properties
.
name
- Property name.value
- Property value.
public String getProperty(String name)
public String removeProperty(String name)
name
- Property name.
protected String makeIndexPropertyName(String base, int index)
base
- Base property name.index
- Property index.
public String[] getArrayProperty(String base, String[] defaultValues)
Array properties are specified as:
Indexes begin with zero and must be contiguous. A break in
continuity signals the end of the array.
base_property_name.INDEX.
base
- Base property name.defaultValues
- Default property values.
public String[] getArrayProperty(String name)
name
- Property name.
public Iterator names()
public boolean containsProperty(String name)
name
- Property name.
public PropertyGroup getPropertyGroup(String basename)
basename
- Base property name.
public PropertyGroup getPropertyGroup(String basename, int index)
basename
- Base property name.index
- Array property index.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |