org.riotfamily.components.model.wrapper
Class MapWrapper

java.lang.Object
  extended by org.riotfamily.components.model.wrapper.ValueWrapper<Map<String,Object>>
      extended by org.riotfamily.components.model.wrapper.MapWrapper
All Implemented Interfaces:
Map<String,Object>

public class MapWrapper
extends ValueWrapper<Map<String,Object>>
implements Map<String,Object>

Since:
7.0
Author:
Felix Gnass [fgnass at neteye dot de]

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
MapWrapper()
           
 
Method Summary
 void clear()
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
 MapWrapper deepCopy()
          Creates a deep copy.
 void each(ValueCallback callback)
           
 Set<Map.Entry<String,Object>> entrySet()
           
 boolean equals(Object obj)
          Delegates the call to the equals method of the wrapped object.
 Object get(Object key)
           
 Map<String,Object> getValue()
          Returns the value that is passed to the form element when the value is edited.
 ValueWrapper<?> getWrapper(String key)
           
 Map<String,Object> getWrapperMap()
           
 int hashCode()
          Delegates the call to the hashCode method of the wrapped object.
 boolean isEmpty()
           
 Set<String> keySet()
           
 Object put(String key, Object value)
           
 void putAll(Map<? extends String,?> map)
           
 Object remove(Object key)
           
 void setValue(Map<String,Object> value)
           
 void setWrapperMap(Map<String,Object> wrapperMap)
           
 int size()
           
 Map<String,Object> unwrap()
          Returns the wrapped value.
 Collection<Object> values()
           
 void wrap(Object value)
          Wraps the given value.
 
Methods inherited from class org.riotfamily.components.model.wrapper.ValueWrapper
getId, setId, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MapWrapper

public MapWrapper()
Method Detail

getWrapperMap

public Map<String,Object> getWrapperMap()

setWrapperMap

public void setWrapperMap(Map<String,Object> wrapperMap)

wrap

public void wrap(Object value)
Description copied from class: ValueWrapper
Wraps the given value. The default implementation delegates the call to ValueWrapper.setValue(Object).

Overrides:
wrap in class ValueWrapper<Map<String,Object>>

getValue

public Map<String,Object> getValue()
Description copied from class: ValueWrapper
Returns the value that is passed to the form element when the value is edited. Subclasses will usually return the wrapped value, except for complex wrappers (like ListWrapper and MapWrapper) which return a self-reference.

Specified by:
getValue in class ValueWrapper<Map<String,Object>>

setValue

public void setValue(Map<String,Object> value)
Specified by:
setValue in class ValueWrapper<Map<String,Object>>

getWrapper

public ValueWrapper<?> getWrapper(String key)

unwrap

public Map<String,Object> unwrap()
Description copied from class: ValueWrapper
Returns the wrapped value. The default implementation delegates the call to ValueWrapper.getValue(). Subclasses that wrap complex values (values with nested wrappers) must overwrite this method to perform a "deep-unwrapping".

Overrides:
unwrap in class ValueWrapper<Map<String,Object>>

deepCopy

public MapWrapper deepCopy()
Description copied from class: ValueWrapper
Creates a deep copy. Subclasses will usually just create a new wrapper instance and and invoke ValueWrapper.setValue(Object) with the value returned by ValueWrapper.getValue(). Complex wrappers have to make sure that the deepCopy method is invoked for all nested values too.

Specified by:
deepCopy in class ValueWrapper<Map<String,Object>>

each

public void each(ValueCallback callback)
Overrides:
each in class ValueWrapper<Map<String,Object>>

clear

public void clear()
Specified by:
clear in interface Map<String,Object>

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map<String,Object>

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map<String,Object>

keySet

public Set<String> keySet()
Specified by:
keySet in interface Map<String,Object>

entrySet

public Set<Map.Entry<String,Object>> entrySet()
Specified by:
entrySet in interface Map<String,Object>

values

public Collection<Object> values()
Specified by:
values in interface Map<String,Object>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map<String,Object>

size

public int size()
Specified by:
size in interface Map<String,Object>

remove

public Object remove(Object key)
Specified by:
remove in interface Map<String,Object>

get

public Object get(Object key)
Specified by:
get in interface Map<String,Object>

put

public Object put(String key,
                  Object value)
Specified by:
put in interface Map<String,Object>

putAll

public void putAll(Map<? extends String,?> map)
Specified by:
putAll in interface Map<String,Object>

hashCode

public int hashCode()
Description copied from class: ValueWrapper
Delegates the call to the hashCode method of the wrapped object.

Specified by:
hashCode in interface Map<String,Object>
Overrides:
hashCode in class ValueWrapper<Map<String,Object>>

equals

public boolean equals(Object obj)
Description copied from class: ValueWrapper
Delegates the call to the equals method of the wrapped object.

Specified by:
equals in interface Map<String,Object>
Overrides:
equals in class ValueWrapper<Map<String,Object>>