no.sesat.search.datamodel.generic
Class MapDataObjectSupport<V>

java.lang.Object
  extended by no.sesat.search.datamodel.generic.MapDataObjectSupport<V>
All Implemented Interfaces:
Serializable, MapDataObject<V>

@DataObject
public final class MapDataObjectSupport<V>
extends Object
implements MapDataObject<V>

This helper class provides a utility implementation of the no.sesat.search.datamodel.MapDataObject interface.

Since this class directly implements the MapDataObject interface, the class can, and is intended to be used either by subclassing this implementation, or via ad-hoc delegation of an instance of this class from another.

Synchronised implementation of MapDataObject through underlyng usage of ConcurrentHashMap. //Uses a ReentrantReadWriteLock in a delegated HashMap in preference to a Hashtable to maximise performance. //Access to the whole map is through a Collections.unmodifiable(map) defensive copy.

Version:
$Id: MapDataObjectSupport.java 7225 2009-04-09 00:32:20Z ssmiweve $
See Also:
Serialized Form

Constructor Summary
MapDataObjectSupport(Map<String,V> map)
           
 
Method Summary
 V getValue(String key)
          Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
 Map<String,V> getValues()
          Access to whole map is through a Collections.unmodifiable(map) copy.
 void setValue(String key, V value)
          Associates the specified value with the specified key in this map (optional operation).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapDataObjectSupport

public MapDataObjectSupport(Map<String,V> map)
Method Detail

getValue

public V getValue(String key)
Description copied from interface: MapDataObject
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

Specified by:
getValue in interface MapDataObject<V>
Returns:

setValue

public void setValue(String key,
                     V value)
Description copied from interface: MapDataObject
Associates the specified value with the specified key in this map (optional operation). If the map previously contained a mapping for the key, the old value is replaced by the specified value. (A map m is said to contain a mapping for a key k if and only if m.containsKey(k) would return true.)

If the value is null remove(key) is called on the underlying map.

Specified by:
setValue in interface MapDataObject<V>

getValues

public Map<String,V> getValues()
Description copied from interface: MapDataObject
Access to whole map is through a Collections.unmodifiable(map) copy.

Specified by:
getValues in interface MapDataObject<V>
Returns:


Copyright © 2005-2009 Schibsted ASA. All Rights Reserved.