FileDocCategorySizeDatePackage
EnumeratedMap.javaAPI DocGlassfish v2 API5889Sat May 05 19:17:26 BST 2007org.apache.taglibs.standard.lang.jstl

EnumeratedMap

public abstract class EnumeratedMap extends Object implements 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.

author
Nathan Abramson - Art Technology Group
version
$Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: tcfujii $

Fields Summary
Map
mMap
Constructors Summary
Methods Summary
public voidclear()

    throw new UnsupportedOperationException ();
  
public booleancontainsKey(java.lang.Object pKey)

    return getValue (pKey) != null;
  
public booleancontainsValue(java.lang.Object pValue)

    return getAsMap ().containsValue (pValue);
  
java.util.MapconvertToMap()
Converts to a Map

    Map ret = new HashMap ();
    for (Enumeration e = enumerateKeys (); e.hasMoreElements (); ) {
      Object key = e.nextElement ();
      Object value = getValue (key);
      ret.put (key, value);
    }
    return ret;
  
public java.util.SetentrySet()

    return getAsMap ().entrySet ();
  
public abstract java.util.EnumerationenumerateKeys()
Returns an enumeration of the keys

public java.lang.Objectget(java.lang.Object pKey)

    return getValue (pKey);
  
public java.util.MapgetAsMap()
Converts the MapSource to a Map. If the map is not mutable, this is cached

    if (mMap != null) {
      return mMap;
    }
    else {
      Map m = convertToMap ();
      if (!isMutable ()) {
	mMap = m;
      }
      return m;
    }
  
public abstract java.lang.ObjectgetValue(java.lang.Object pKey)
Returns the value associated with the given key, or null if not found.

public booleanisEmpty()

    return !enumerateKeys ().hasMoreElements ();
  
public abstract booleanisMutable()
Returns true if it is possible for this data source to change

public java.util.SetkeySet()

    return getAsMap ().keySet ();
  
public java.lang.Objectput(java.lang.Object pKey, java.lang.Object pValue)

    throw new UnsupportedOperationException ();
  
public voidputAll(java.util.Map pMap)

    throw new UnsupportedOperationException ();
  
public java.lang.Objectremove(java.lang.Object pKey)

    throw new UnsupportedOperationException ();
  
public intsize()

    return getAsMap ().size ();
  
public java.util.Collectionvalues()

    return getAsMap ().values ();