com.opensymphony.module.propertyset.memory
Class MemoryPropertySet

java.lang.Object
  extended bycom.opensymphony.module.propertyset.AbstractPropertySet
      extended bycom.opensymphony.module.propertyset.memory.MemoryPropertySet
All Implemented Interfaces:
PropertySet
Direct Known Subclasses:
PropertiesFilePropertySet, SerializablePropertySet

public class MemoryPropertySet
extends AbstractPropertySet

The MemoryPropertySet is a PropertySet implementation that will store any primitive or object in an internal Map that is stored in memory.

An alternative to MemoryPropertySet is SerializablePropertySet which can be Serialized to/from a stream.

Version:
$Revision: 1.4 $
Author:
Joe Walnes
See Also:
PropertySet

Nested Class Summary
static class MemoryPropertySet.ValueEntry
           
 
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
MemoryPropertySet()
           
 
Method Summary
 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.
protected  java.util.HashMap getMap()
           
 int getType(java.lang.String key)
          Returns type of value.
 void init(java.util.Map config, java.util.Map args)
           
 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)
           
 
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, isSettable, 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

MemoryPropertySet

public MemoryPropertySet()
Method Detail

getKeys

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

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.

getType

public int getType(java.lang.String key)
Description copied from interface: PropertySet
Returns type of value.

Returns:
Type of value. See static class variables.

exists

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


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(java.lang.String key)
Description copied from interface: PropertySet
Removes property.


remove

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

Throws:
PropertyException - if there is an error removing the propertyset.

setImpl

protected void setImpl(int type,
                       java.lang.String key,
                       java.lang.Object value)
                throws DuplicatePropertyKeyException
Specified by:
setImpl in class AbstractPropertySet
Throws:
DuplicatePropertyKeyException

getMap

protected java.util.HashMap getMap()

get

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

See www.opensymphony.com for more information.

Copyright 2000-2005 - OpenSymphony