org.millscript.commons.util.defaults
Class ChainedMapDefault<K,V>

java.lang.Object
  extended by org.millscript.commons.util.defaults.ChainedMapDefault<K,V>
All Implemented Interfaces:
IMapDefault<K,V>

public class ChainedMapDefault<K,V>
extends java.lang.Object
implements IMapDefault<K,V>

This class provides a default implementation which chains maps together. The specified key is looked up in the parent map and the value from that parent mapping is returned.


Constructor Summary
ChainedMapDefault(IMap<K,V> map)
          Constructs a new default which looks up missing keys in the specified map.
 
Method Summary
 V get(IMap<K,V> map, K key)
          Returns the value to use when the specified key is not valid in the for the mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChainedMapDefault

public ChainedMapDefault(IMap<K,V> map)
Constructs a new default which looks up missing keys in the specified map.

Parameters:
map - the parent map to lookup missing keys in
Method Detail

get

public V get(IMap<K,V> map,
             K key)
Description copied from interface: IMapDefault
Returns the value to use when the specified key is not valid in the for the mapping.

Specified by:
get in interface IMapDefault<K,V>
Parameters:
map - the map which requested the default value for the given key
key - the key that is not valid for the mapping
Returns:
the default value for when the key is not valid
See Also:
org.millscript.commons.util.IMapDefault#get(org.millscript.commons.util.IMap, K)


Copyright © 2005-2007 Open World Ltd. All Rights Reserved.