biz.hammurapi.properties
Class PropertySubSet

java.lang.Object
  extended by biz.hammurapi.properties.PropertySubSet
All Implemented Interfaces:
Context, MutableContext, PropertySet

public class PropertySubSet
extends java.lang.Object
implements PropertySet

Wrapper around a property set to get access to a sub-set of properties based on prefix.

Author:
Pavel

Constructor Summary
PropertySubSet(PropertySet master, java.lang.String prefix)
           
 
Method Summary
 void clear()
          Removes all entries from the property set
 boolean compareProperties(PropertySet otherSet)
           
 boolean containsAll(PropertySet subSet)
           
 java.lang.Object get(java.lang.String name)
          Retrieves property.
 java.lang.Object get(java.lang.String name, java.lang.Object defaultValue)
           
 java.util.Set getPropertyNames()
           
 PropertySet getSubset(java.lang.String prefix)
           
 void mount(java.lang.String prefix, PropertySet source)
          Mounts source property set at specified prefix.
 boolean remove(java.lang.String name)
          Removes context value.
 void set(java.lang.String name, java.lang.Object value)
          Sets context value.
 void setAll(PropertySet source)
          Copies all entries from the source property set to self.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertySubSet

public PropertySubSet(PropertySet master,
                      java.lang.String prefix)
Method Detail

getPropertyNames

public java.util.Set getPropertyNames()
Specified by:
getPropertyNames in interface PropertySet
Returns:
Names of properties in the set

getSubset

public PropertySet getSubset(java.lang.String prefix)
Specified by:
getSubset in interface PropertySet
Returns:
Property set which operates on properties starting with given prefix.

remove

public boolean remove(java.lang.String name)
Description copied from interface: MutableContext
Removes context value.

Specified by:
remove in interface MutableContext
Specified by:
remove in interface PropertySet
Returns:
true if operation was successful. In some cases removal of name/value pair may not be supported (e.g. chained contexts).

set

public void set(java.lang.String name,
                java.lang.Object value)
Description copied from interface: MutableContext
Sets context value.

Specified by:
set in interface MutableContext
Specified by:
set in interface PropertySet

get

public java.lang.Object get(java.lang.String name)
Description copied from interface: PropertySet
Retrieves property.

Specified by:
get in interface Context
Specified by:
get in interface PropertySet

clear

public void clear()
Description copied from interface: PropertySet
Removes all entries from the property set

Specified by:
clear in interface PropertySet

mount

public void mount(java.lang.String prefix,
                  PropertySet source)
Description copied from interface: PropertySet
Mounts source property set at specified prefix. E.g. if source property set has entry 'a' and prefix is 'b/' then that entry will be available as 'b/a'. Own property set entries shall shadow mounted entries.

Specified by:
mount in interface PropertySet

setAll

public void setAll(PropertySet source)
Description copied from interface: PropertySet
Copies all entries from the source property set to self.

Specified by:
setAll in interface PropertySet

compareProperties

public boolean compareProperties(PropertySet otherSet)
Specified by:
compareProperties in interface PropertySet
Returns:
true if other property set entries are equal to this property set entries. Other Property set attribute

containsAll

public boolean containsAll(PropertySet subSet)
Specified by:
containsAll in interface PropertySet
Returns:
true if all properties of subset are present in this set with same values

get

public java.lang.Object get(java.lang.String name,
                            java.lang.Object defaultValue)
Specified by:
get in interface PropertySet
Parameters:
name - Property name.
defaultValue - Default value.
Returns:
Property value or default value if property doesn't exist in the property set.


Copyright © 2003 Hammurapi Group. All Rights Reserved.