org.jboss.portal.portlet.state
Class AbstractPropertyMap

java.lang.Object
  extended by org.jboss.portal.common.util.TypedMap
      extended by org.jboss.portal.portlet.state.AbstractPropertyMap
All Implemented Interfaces:
java.util.Map, PropertyMap
Direct Known Subclasses:
SimplePropertyMap

public abstract class AbstractPropertyMap
extends TypedMap
implements PropertyMap

Version:
$Revision: 6643 $
Author:
Julien Viet

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jboss.portal.common.util.TypedMap
TypedMap.KeySet, TypedMap.TypedEntrySet, TypedMap.ValueCollection
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
 
Fields inherited from class org.jboss.portal.common.util.TypedMap
accessor
 
Constructor Summary
protected AbstractPropertyMap(java.util.Map delegate)
           
protected AbstractPropertyMap(MapAccessor accessor)
           
 
Method Summary
protected  void assertKeyValidity(java.lang.Object value)
          Only accept non null string objects.
protected  java.lang.Object getExternalValue(java.lang.Object value)
          Wrap the internal value into its external representation.
protected  java.lang.Object getInternalValue(java.lang.Object value)
          Only check are made to the value.
 Value getProperty(java.lang.String key)
          Return the value for the given key or null if it does not exist.
 void setProperty(java.lang.String key, Value value)
          Update the value of the given key.
 
Methods inherited from class org.jboss.portal.common.util.TypedMap
clear, containsKey, containsValue, convert, entrySet, equals, get, getDelegate, getExternalKey, getInternalKey, internalValueEquals, isEmpty, keySet, put, putAll, remove, replace, size, toString, unwrapKey, unwrapValue, validate, values, wrapKey, wrapValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Constructor Detail

AbstractPropertyMap

protected AbstractPropertyMap(MapAccessor accessor)

AbstractPropertyMap

protected AbstractPropertyMap(java.util.Map delegate)
Method Detail

assertKeyValidity

protected void assertKeyValidity(java.lang.Object value)
Only accept non null string objects.

Overrides:
assertKeyValidity in class TypedMap
Throws:
java.lang.ClassCastException - if the value is not an instance of string

getInternalValue

protected java.lang.Object getInternalValue(java.lang.Object value)
Only check are made to the value. The only valid values accepted are non null instance of org.jboss.portal.common.value.Value.

Overrides:
getInternalValue in class TypedMap
Parameters:
value - the value to unwrap
Returns:
the unwrapped value
Throws:
java.lang.NullPointerException - if the value is null
java.lang.ClassCastException - if the value type is not an instance of org.jboss.portal.common.value.Value

getExternalValue

protected java.lang.Object getExternalValue(java.lang.Object value)
Description copied from class: TypedMap
Wrap the internal value into its external representation. The external representation value should not be null. If it is not possible to obtain an external value representation of the internal value, then the the null value should be returned from this method.

Overrides:
getExternalValue in class TypedMap
Parameters:
value - the param value which will not be null
Returns:
the external value

getProperty

public Value getProperty(java.lang.String key)
                  throws java.lang.IllegalArgumentException
Description copied from interface: PropertyMap
Return the value for the given key or null if it does not exist.

Specified by:
getProperty in interface PropertyMap
Parameters:
key - the requested key
Returns:
the requested value or null if it does not exist
Throws:
java.lang.IllegalArgumentException - if the key is null

setProperty

public void setProperty(java.lang.String key,
                        Value value)
                 throws java.lang.IllegalArgumentException
Description copied from interface: PropertyMap
Update the value of the given key. If the value object is null it means that the entry must be removed. Implementation can throw an unsupported operation exception when it is abnormal to perform an update.

Specified by:
setProperty in interface PropertyMap
Parameters:
key - the key to update
value - the new value
Throws:
java.lang.IllegalArgumentException - if the key is null