org.inria.ns.reflex.util
Class DeferredEntryMap

java.lang.Object
  extended by org.inria.ns.reflex.util.DeferredMap
      extended by org.inria.ns.reflex.util.DeferredEntryMap
All Implemented Interfaces:
Map, EntryBuilder, EntryMap

public class DeferredEntryMap
extends DeferredMap
implements Map, EntryMap

A deferred map that has its entries instance of Map.Entry. It is useful for a large set of entries. For a small set of entries, consider an EntryMap. If the values must not be instances of Map.Entry, consider a DeferredMap (in fact they could but only if they are stored as-is, which is different from this class that always wrap values in a Map.Entry).

Author:
Philippe Poulard
See Also:
Map.Entry, EntryMap

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.inria.ns.reflex.util.EntryMap
EntryMap.Impl
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
DeferredEntryMap(EntryFactory factory)
          Create a new deferred map.
 
Method Summary
 boolean containsValue(Object value)
          Indicates whether an entry value is in this map or not.
 Set entrySet()
          Get the set of entries in this map.
 Object get(Object key)
          Get an entry.
 Map.Entry newEntry(Object key, Object value)
          Create a new entry ; this method doesn't store it in this map, it is just a delegate method to the factory.
 Object put(Map.Entry entry)
          Store an entry as is in this map.
 Object put(Object key, Object value)
          Store an entry in this map.
 void putAll(Map map)
          Store all the entries of a map in this map.
 
Methods inherited from class org.inria.ns.reflex.util.DeferredMap
clear, containsKey, equals, getAll, hashCode, isEmpty, keySet, remove, removeEntry, size, values
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, containsKey, equals, hashCode, isEmpty, keySet, remove, size, values
 

Constructor Detail

DeferredEntryMap

public DeferredEntryMap(EntryFactory factory)
Create a new deferred map.

Parameters:
factory - The factory that can build new entries.
Method Detail

newEntry

public Map.Entry newEntry(Object key,
                          Object value)
Create a new entry ; this method doesn't store it in this map, it is just a delegate method to the factory.

Specified by:
newEntry in interface EntryBuilder
Parameters:
key - The key of the entry.
value - The value of the entry.
Returns:
The entry.

containsValue

public boolean containsValue(Object value)
Indicates whether an entry value is in this map or not.

Specified by:
containsValue in interface Map
Overrides:
containsValue in class DeferredMap
Parameters:
value - The entry value.
Returns:
true if the entry value is in this map, false otherwise.

entrySet

public Set entrySet()
Get the set of entries in this map. Force all entries to be stored in the internal map.

Specified by:
entrySet in interface Map
Overrides:
entrySet in class DeferredMap
Returns:
A set of entries.

put

public Object put(Map.Entry entry)
Store an entry as is in this map.

The entry stored should be of the type expected (the same than those built by the entry builder). This method doesn't check the compatibility of the entry given with those expected internally.

Specified by:
put in interface EntryMap
Parameters:
entry - The entry to store.
Returns:
The previous entry.
See Also:
EntryBuilder.newEntry(Object, Object)

put

public Object put(Object key,
                  Object value)
Store an entry in this map.

Specified by:
put in interface Map
Overrides:
put in class DeferredMap
Parameters:
key - The entry key.
value - The entry value.
Returns:
The previous value of the entry.

get

public Object get(Object key)
Get an entry.

Specified by:
get in interface Map
Overrides:
get in class DeferredMap
Parameters:
key - The entry key to get.
Returns:
The entry.

putAll

public void putAll(Map map)
Store all the entries of a map in this map.

Specified by:
putAll in interface Map
Overrides:
putAll in class DeferredMap
Parameters:
map - The map to store in this map.