org.jboss.util.property
Class PropertyGroup

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<Object,Object>
          extended by java.util.Properties
              extended by org.jboss.util.property.PropertyMap
                  extended by org.jboss.util.property.PropertyGroup
All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>

public class PropertyGroup
extends PropertyMap

This is a helper class to access a group of properties with out having to refer to their full names.

This class needs more work to be fully functional. It should suffice for adding property listeners and getting/setting property values, but other activies might not work out so well.

Version:
$Revision: 1.4.6.2 $
Author:
Jason Dillon, Adrian Brock
See Also:
Serialized Form

Field Summary
protected  String basename
          Base property name
 
Fields inherited from class org.jboss.util.property.PropertyMap
boundListeners, EMPTY_ARRAY_PROPERTY, PROPERTY_NAME_SEPARATOR, unboundListeners
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
PropertyGroup(String basename, Properties container)
          Construct a PropertyGroup.
 
Method Summary
protected  void addPropertyListener(BoundPropertyListener listener)
          Add a bound property listener.
 boolean containsKey(Object name)
          Check if this PropertyMap contains a given property name.
 Set entrySet()
          Returns an entry set for all properties in this group.
 Object get(Object name)
          Get a property
 String getBaseName()
          Get the base property name for this group.
 Object put(Object name, Object value)
          Set a property.
 Object remove(Object name)
          Remove a property.
protected  boolean removePropertyListener(BoundPropertyListener listener)
          Remove a bound property listener.
 
Methods inherited from class org.jboss.util.property.PropertyMap
addPropertyListener, addPropertyListeners, containsProperty, entrySet, firePropertyAdded, firePropertyChanged, firePropertyRemoved, getArrayProperty, getArrayProperty, getProperty, getPropertyGroup, getPropertyGroup, keySet, load, load, load, load, makeIndexPropertyName, makePrefixedPropertyName, names, removeProperty, removePropertyListener, setProperty
 
Methods inherited from class java.util.Properties
getProperty, list, list, load, loadFromXML, propertyNames, save, store, storeToXML, storeToXML
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsValue, elements, equals, 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

basename

protected final String basename
Base property name

Constructor Detail

PropertyGroup

public PropertyGroup(String basename,
                     Properties container)
Construct a PropertyGroup.

Parameters:
basename - Base property name.
container - Property container.
Throws:
NullArgumentException - Basename is null.
Method Detail

getBaseName

public final String getBaseName()
Get the base property name for this group.

Returns:
Base property name.

containsKey

public boolean containsKey(Object name)
Check if this PropertyMap contains a given property name.

Specified by:
containsKey in interface Map<Object,Object>
Overrides:
containsKey in class Hashtable<Object,Object>
Parameters:
name - Property name.
Returns:
True if property map or defaults contains key.

put

public Object put(Object name,
                  Object value)
Set a property.

Specified by:
put in interface Map<Object,Object>
Overrides:
put in class PropertyMap
Parameters:
name - Property name.
value - Property value.
Returns:
Previous property value or null.

get

public Object get(Object name)
Get a property

Specified by:
get in interface Map<Object,Object>
Overrides:
get in class Hashtable<Object,Object>
Parameters:
name - Property name.
Returns:
Property value or null.

remove

public Object remove(Object name)
Remove a property.

Specified by:
remove in interface Map<Object,Object>
Overrides:
remove in class PropertyMap
Parameters:
name - Property name.
Returns:
Removed property value.

entrySet

public Set entrySet()
Returns an entry set for all properties in this group.

This is currently ver inefficient, but should get the job done for now.

Specified by:
entrySet in interface Map<Object,Object>
Overrides:
entrySet in class Hashtable<Object,Object>

addPropertyListener

protected void addPropertyListener(BoundPropertyListener listener)
Add a bound property listener.

Generates a fully qualified property name and adds the listener under that name.

Overrides:
addPropertyListener in class PropertyMap
Parameters:
listener - Bound property listener to add.

removePropertyListener

protected boolean removePropertyListener(BoundPropertyListener listener)
Remove a bound property listener.

Generates a fully qualified property name and removes the listener under that name.

Overrides:
removePropertyListener in class PropertyMap
Parameters:
listener - Bound property listener to remove.
Returns:
True if listener was removed.


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.