Package org.jboss.util.property
Class PropertyGroup
- java.lang.Object
-
- java.util.Dictionary<K,V>
-
- java.util.Hashtable<java.lang.Object,java.lang.Object>
-
- java.util.Properties
-
- org.jboss.util.property.PropertyMap
-
- org.jboss.util.property.PropertyGroup
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.Map<java.lang.Object,java.lang.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$
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
basename
Base property nameprivate static long
serialVersionUID
Serial version uid-
Fields inherited from class org.jboss.util.property.PropertyMap
boundListeners, EMPTY_ARRAY_PROPERTY, PROPERTY_NAME_SEPARATOR, unboundListeners
-
-
Constructor Summary
Constructors Constructor Description PropertyGroup(java.lang.String basename, java.util.Properties container)
Construct a PropertyGroup.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addPropertyListener(BoundPropertyListener listener)
Add a bound property listener.boolean
containsKey(java.lang.Object name)
Check if this PropertyMap contains a given property name.java.util.Set
entrySet()
Returns an entry set for all properties in this group.java.lang.Object
get(java.lang.Object name)
Get a propertyjava.lang.String
getBaseName()
Get the base property name for this group.private java.lang.String
makePropertyName(java.lang.Object suffix)
Make a fully qualified property name.private java.lang.String
makePropertyName(java.lang.String suffix)
Make a fully qualified property name.java.lang.Object
put(java.lang.Object name, java.lang.Object value)
Set a property.java.lang.Object
remove(java.lang.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
clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsValue, elements, equals, forEach, getOrDefault, getProperty, hashCode, isEmpty, keys, keySet, list, list, load, load, loadFromXML, merge, propertyNames, putAll, putIfAbsent, rehash, remove, replace, replace, replaceAll, save, size, store, store, storeToXML, storeToXML, storeToXML, stringPropertyNames, toString, values
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serial version uid- See Also:
- Constant Field Values
-
basename
protected final java.lang.String basename
Base property name
-
-
Constructor Detail
-
PropertyGroup
public PropertyGroup(java.lang.String basename, java.util.Properties container)
Construct a PropertyGroup.- Parameters:
basename
- Base property name.container
- Property container.- Throws:
NullArgumentException
- Basename is null.
-
-
Method Detail
-
getBaseName
public final java.lang.String getBaseName()
Get the base property name for this group.- Returns:
- Base property name.
-
makePropertyName
private java.lang.String makePropertyName(java.lang.String suffix)
Make a fully qualified property name.- Parameters:
suffix
- Property name suffix.
-
makePropertyName
private java.lang.String makePropertyName(java.lang.Object suffix)
Make a fully qualified property name.- Parameters:
suffix
- Property name suffix.
-
containsKey
public boolean containsKey(java.lang.Object name)
Check if this PropertyMap contains a given property name.- Specified by:
containsKey
in interfacejava.util.Map<java.lang.Object,java.lang.Object>
- Overrides:
containsKey
in classjava.util.Properties
- Parameters:
name
- Property name.- Returns:
- True if property map or defaults contains key.
-
put
public java.lang.Object put(java.lang.Object name, java.lang.Object value)
Set a property.- Specified by:
put
in interfacejava.util.Map<java.lang.Object,java.lang.Object>
- Overrides:
put
in classPropertyMap
- Parameters:
name
- Property name.value
- Property value.- Returns:
- Previous property value or null.
-
get
public java.lang.Object get(java.lang.Object name)
Get a property- Specified by:
get
in interfacejava.util.Map<java.lang.Object,java.lang.Object>
- Overrides:
get
in classjava.util.Properties
- Parameters:
name
- Property name.- Returns:
- Property value or null.
-
remove
public java.lang.Object remove(java.lang.Object name)
Remove a property.- Specified by:
remove
in interfacejava.util.Map<java.lang.Object,java.lang.Object>
- Overrides:
remove
in classPropertyMap
- Parameters:
name
- Property name.- Returns:
- Removed property value.
-
entrySet
public java.util.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 interfacejava.util.Map<java.lang.Object,java.lang.Object>
- Overrides:
entrySet
in classjava.util.Properties
-
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 classPropertyMap
- 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 classPropertyMap
- Parameters:
listener
- Bound property listener to remove.- Returns:
- True if listener was removed.
-
-