org.apache.sling.api.wrappers
Class ValueMapDecorator

java.lang.Object
  extended by org.apache.sling.api.wrappers.ValueMapDecorator
All Implemented Interfaces:
java.util.Map<java.lang.String,java.lang.Object>, ValueMap

public class ValueMapDecorator
extends java.lang.Object
implements ValueMap

ValueMapDecorator decorates another Map to provide a basic implementation for the additional methods of a ValueMap.


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
 
Fields inherited from interface org.apache.sling.api.resource.ValueMap
EMPTY
 
Constructor Summary
ValueMapDecorator(java.util.Map<java.lang.String,java.lang.Object> base)
          Creates a new wrapper around a given map.
 
Method Summary
 void clear()
          
 boolean containsKey(java.lang.Object key)
          
 boolean containsValue(java.lang.Object value)
          
 java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
          
 java.lang.Object get(java.lang.Object key)
          
<T> T
get(java.lang.String name, java.lang.Class<T> type)
          Get a named property and convert it into the given type.
<T> T
get(java.lang.String name, T defaultValue)
          Get a named property and convert it into the given type.
 boolean isEmpty()
          
 java.util.Set<java.lang.String> keySet()
          
 java.lang.Object put(java.lang.String key, java.lang.Object value)
          
 void putAll(java.util.Map<? extends java.lang.String,?> t)
          
 java.lang.Object remove(java.lang.Object key)
          
 int size()
          
 java.util.Collection<java.lang.Object> values()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

ValueMapDecorator

public ValueMapDecorator(java.util.Map<java.lang.String,java.lang.Object> base)
Creates a new wrapper around a given map.

Parameters:
base - wrapped object
Method Detail

get

public <T> T get(java.lang.String name,
                 java.lang.Class<T> type)
Get a named property and convert it into the given type.

Specified by:
get in interface ValueMap
Parameters:
name - The name of the property
type - The class of the type
Returns:
Return named value converted to type T or null if non existing or can't be converted.

get

public <T> T get(java.lang.String name,
                 T defaultValue)
Get a named property and convert it into the given type.

Specified by:
get in interface ValueMap
Parameters:
name - The name of the property
defaultValue - The default value to use if the named property does not exist or cannot be converted to the requested type. The default value is also used to define the type to convert the value to. If this is null any existing propert is not converted.
Returns:
Return named value converted to type T or the default value if non existing or can't be converted.

size

public int size()

Specified by:
size in interface java.util.Map<java.lang.String,java.lang.Object>

isEmpty

public boolean isEmpty()

Specified by:
isEmpty in interface java.util.Map<java.lang.String,java.lang.Object>

containsKey

public boolean containsKey(java.lang.Object key)

Specified by:
containsKey in interface java.util.Map<java.lang.String,java.lang.Object>

containsValue

public boolean containsValue(java.lang.Object value)

Specified by:
containsValue in interface java.util.Map<java.lang.String,java.lang.Object>

get

public java.lang.Object get(java.lang.Object key)

Specified by:
get in interface java.util.Map<java.lang.String,java.lang.Object>

put

public java.lang.Object put(java.lang.String key,
                            java.lang.Object value)

Specified by:
put in interface java.util.Map<java.lang.String,java.lang.Object>

remove

public java.lang.Object remove(java.lang.Object key)

Specified by:
remove in interface java.util.Map<java.lang.String,java.lang.Object>

putAll

public void putAll(java.util.Map<? extends java.lang.String,?> t)

Specified by:
putAll in interface java.util.Map<java.lang.String,java.lang.Object>

clear

public void clear()

Specified by:
clear in interface java.util.Map<java.lang.String,java.lang.Object>

keySet

public java.util.Set<java.lang.String> keySet()

Specified by:
keySet in interface java.util.Map<java.lang.String,java.lang.Object>

values

public java.util.Collection<java.lang.Object> values()

Specified by:
values in interface java.util.Map<java.lang.String,java.lang.Object>

entrySet

public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()

Specified by:
entrySet in interface java.util.Map<java.lang.String,java.lang.Object>


Copyright © 2007-2009. All Rights Reserved.