com.opensymphony.module.propertyset.aggregate
Class AggregatePropertySet

java.lang.Object
  extended bycom.opensymphony.module.propertyset.AbstractPropertySet
      extended bycom.opensymphony.module.propertyset.aggregate.AggregatePropertySet
All Implemented Interfaces:
PropertySet, java.io.Serializable

public class AggregatePropertySet
extends AbstractPropertySet
implements java.io.Serializable

PropertySet composed of a collection of other propertysets. Tried each of the propertysets to find a value, tries to be as fault tolerant as possible, in that when any error occurs, it simply tries the operation on the next set.

Optional Args

  • PropertySets - a List of PropertySet
Date: Dec 16, 2001 Time: 11:28:06 PM

Author:
Hani Suleiman
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.opensymphony.module.propertyset.AbstractPropertySet
schema
 
Fields inherited from interface com.opensymphony.module.propertyset.PropertySet
BOOLEAN, DATA, DATE, DOUBLE, INT, LONG, OBJECT, PROPERTIES, STRING, TEXT, XML
 
Constructor Summary
AggregatePropertySet()
           
 
Method Summary
 void addPropertySet(PropertySet propertySet)
           
 boolean exists(java.lang.String key)
          Determine if property exists.
protected  java.lang.Object get(int type, java.lang.String key)
           
 java.util.Collection getKeys(java.lang.String prefix, int type)
          List all keys starting with supplied prefix of certain type.
 int getType(java.lang.String key)
          Checks all propertysets for the specified property.
 void init(java.util.Map config, java.util.Map args)
           
 boolean isSettable(java.lang.String property)
          Returns true.
 void remove()
          Remove the propertyset and all it associated keys.
 void remove(java.lang.String key)
          Removes property.
protected  void setImpl(int type, java.lang.String key, java.lang.Object value)
          Attempts to set a property in one of the propertysets.
 
Methods inherited from class com.opensymphony.module.propertyset.AbstractPropertySet
getAsActualType, getBoolean, getData, getDate, getDouble, getInt, getKeys, getKeys, getKeys, getLong, getObject, getProperties, getSchema, getString, getText, getXML, setAsActualType, setBoolean, setData, setDate, setDouble, setInt, setLong, setObject, setProperties, setSchema, setString, setText, setXML, supportsType, supportsTypes, toString, type, type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AggregatePropertySet

public AggregatePropertySet()
Method Detail

getKeys

public java.util.Collection getKeys(java.lang.String prefix,
                                    int type)
                             throws PropertyException
Description copied from interface: PropertySet
List all keys starting with supplied prefix of certain type. See statics.

Specified by:
getKeys in interface PropertySet
Parameters:
prefix - String that keys must start with. If null, than all keys shall be returned.
type - Type to list. See static class variables. If null, then all types shall be returned.
Returns:
Unmodifiable Collection of Strings.
Throws:
PropertyException

isSettable

public boolean isSettable(java.lang.String property)
Description copied from class: AbstractPropertySet
Returns true.

Specified by:
isSettable in interface PropertySet
Overrides:
isSettable in class AbstractPropertySet

getType

public int getType(java.lang.String key)
            throws PropertyException
Checks all propertysets for the specified property. If a match is found, the type for the match is returned. Note that the first match is what is checked, other propertysets might also define this key, but they would not be checked.

Specified by:
getType in interface PropertySet
Returns:
Type of value. See static class variables.
Throws:
PropertyException

addPropertySet

public void addPropertySet(PropertySet propertySet)

exists

public boolean exists(java.lang.String key)
               throws PropertyException
Description copied from interface: PropertySet
Determine if property exists.

Specified by:
exists in interface PropertySet
Throws:
PropertyException

init

public void init(java.util.Map config,
                 java.util.Map args)
Specified by:
init in interface PropertySet
Overrides:
init in class AbstractPropertySet

remove

public void remove()
            throws PropertyException
Description copied from interface: PropertySet
Remove the propertyset and all it associated keys.

Specified by:
remove in interface PropertySet
Throws:
PropertyException - if there is an error removing the propertyset.

remove

public void remove(java.lang.String key)
            throws PropertyException
Description copied from interface: PropertySet
Removes property.

Specified by:
remove in interface PropertySet
Throws:
PropertyException

setImpl

protected void setImpl(int type,
                       java.lang.String key,
                       java.lang.Object value)
                throws PropertyException
Attempts to set a property in one of the propertysets. Note that this method returns at the FIRST successful set call, rather than setting the same property on all the propertysets.

Specified by:
setImpl in class AbstractPropertySet
Throws:
PropertyException

get

protected java.lang.Object get(int type,
                               java.lang.String key)
                        throws PropertyException
Specified by:
get in class AbstractPropertySet
Throws:
PropertyException

See www.opensymphony.com for more information.

Copyright 2000-2005 - OpenSymphony