Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.commons.el
Class EnumeratedMap  view EnumeratedMap download EnumeratedMap.java

java.lang.Object
  extended byorg.apache.commons.el.EnumeratedMap
All Implemented Interfaces:
java.util.Map

public abstract class EnumeratedMap
extends java.lang.Object
implements java.util.Map

This is a Map implementation driven by a data source that only provides an enumeration of keys and a getValue(key) method. This class must be subclassed to implement those methods.

Some of the methods may incur a performance penalty that involves enumerating the entire data source. In these cases, the Map will try to save the results of that enumeration, but only if the underlying data source is immutable.

Version:
$Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: luehe $

Nested Class Summary
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
(package private)  java.util.Map mMap
           
 
Constructor Summary
EnumeratedMap()
           
 
Method Summary
 void clear()
          Remove all entries from this Map (optional operation).
 boolean containsKey(java.lang.Object pKey)
          Returns true if this contains a mapping for the given key.
 boolean containsValue(java.lang.Object pValue)
          Returns true if this contains at least one mapping with the given value.
(package private)  java.util.Map convertToMap()
          Converts to a Map
 java.util.Set entrySet()
          Returns a set view of the mappings in this Map.
abstract  java.util.Enumeration enumerateKeys()
          Returns an enumeration of the keys
 java.lang.Object get(java.lang.Object pKey)
          Returns the value mapped by the given key.
 java.util.Map getAsMap()
          Converts the MapSource to a Map.
abstract  java.lang.Object getValue(java.lang.Object pKey)
          Returns the value associated with the given key, or null if not found.
 boolean isEmpty()
          Returns true if the map contains no mappings.
abstract  boolean isMutable()
          Returns true if it is possible for this data source to change
 java.util.Set keySet()
          Returns a set view of the keys in this Map.
 java.lang.Object put(java.lang.Object pKey, java.lang.Object pValue)
          Associates the given key to the given value (optional operation).
 void putAll(java.util.Map pMap)
          Copies all entries of the given map to this one (optional operation).
 java.lang.Object remove(java.lang.Object pKey)
          Removes the mapping for this key if present (optional operation).
 int size()
          Returns the number of key-value mappings in the map.
 java.util.Collection values()
          Returns a collection (or bag) view of the values in this Map.
 
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
 

Field Detail

mMap

java.util.Map mMap
Constructor Detail

EnumeratedMap

public EnumeratedMap()
Method Detail

clear

public void clear()
Description copied from interface: java.util.Map
Remove all entries from this Map (optional operation).

Specified by:
clear in interface java.util.Map

containsKey

public boolean containsKey(java.lang.Object pKey)
Description copied from interface: java.util.Map
Returns true if this contains a mapping for the given key.

Specified by:
containsKey in interface java.util.Map

containsValue

public boolean containsValue(java.lang.Object pValue)
Description copied from interface: java.util.Map
Returns true if this contains at least one mapping with the given value. In other words, returns true if a value v exists where (value == null ? v == null : value.equals(v)). This usually requires linear time.

Specified by:
containsValue in interface java.util.Map

entrySet

public java.util.Set entrySet()
Description copied from interface: java.util.Map
Returns a set view of the mappings in this Map. Each element in the set is a Map.Entry. The set is backed by the map, so that changes in one show up in the other. Modifications made while an iterator is in progress cause undefined behavior. If the set supports removal, these methods remove the underlying mapping from the map: Iterator.remove, Set.remove, removeAll, retainAll, and clear. Element addition, via add or addAll, is not supported via this set.

Specified by:
entrySet in interface java.util.Map

get

public java.lang.Object get(java.lang.Object pKey)
Description copied from interface: java.util.Map
Returns the value mapped by the given key. Returns null if there is no mapping. However, in Maps that accept null values, you must rely on containsKey to determine if a mapping exists.

Specified by:
get in interface java.util.Map

isEmpty

public boolean isEmpty()
Description copied from interface: java.util.Map
Returns true if the map contains no mappings.

Specified by:
isEmpty in interface java.util.Map

keySet

public java.util.Set keySet()
Description copied from interface: java.util.Map
Returns a set view of the keys in this Map. The set is backed by the map, so that changes in one show up in the other. Modifications made while an iterator is in progress cause undefined behavior. If the set supports removal, these methods remove the underlying mapping from the map: Iterator.remove, Set.remove, removeAll, retainAll, and clear. Element addition, via add or addAll, is not supported via this set.

Specified by:
keySet in interface java.util.Map

put

public java.lang.Object put(java.lang.Object pKey,
                            java.lang.Object pValue)
Description copied from interface: java.util.Map
Associates the given key to the given value (optional operation). If the map already contains the key, its value is replaced. Be aware that in a map that permits null values, a null return does not always imply that the mapping was created.

Specified by:
put in interface java.util.Map

putAll

public void putAll(java.util.Map pMap)
Description copied from interface: java.util.Map
Copies all entries of the given map to this one (optional operation). If the map already contains a key, its value is replaced.

Specified by:
putAll in interface java.util.Map

remove

public java.lang.Object remove(java.lang.Object pKey)
Description copied from interface: java.util.Map
Removes the mapping for this key if present (optional operation). If the key is not present, this returns null. Note that maps which permit null values may also return null if the key was removed.

Specified by:
remove in interface java.util.Map

size

public int size()
Description copied from interface: java.util.Map
Returns the number of key-value mappings in the map. If there are more than Integer.MAX_VALUE mappings, return Integer.MAX_VALUE.

Specified by:
size in interface java.util.Map

values

public java.util.Collection values()
Description copied from interface: java.util.Map
Returns a collection (or bag) view of the values in this Map. The collection is backed by the map, so that changes in one show up in the other. Modifications made while an iterator is in progress cause undefined behavior. If the collection supports removal, these methods remove the underlying mapping from the map: Iterator.remove, Collection.remove, removeAll, retainAll, and clear. Element addition, via add or addAll, is not supported via this collection.

Specified by:
values in interface java.util.Map

enumerateKeys

public abstract java.util.Enumeration enumerateKeys()
Returns an enumeration of the keys


isMutable

public abstract boolean isMutable()
Returns true if it is possible for this data source to change


getValue

public abstract java.lang.Object getValue(java.lang.Object pKey)
Returns the value associated with the given key, or null if not found.


getAsMap

public java.util.Map getAsMap()
Converts the MapSource to a Map. If the map is not mutable, this is cached


convertToMap

java.util.Map convertToMap()
Converts to a Map