com.sun.jini.lease
Class AbstractLeaseMap

java.lang.Object
  |
  +--com.sun.jini.lease.AbstractLeaseMap
Direct Known Subclasses:
LandlordLeaseMap

public abstract class AbstractLeaseMap
extends java.lang.Object
implements LeaseMap, java.io.Serializable

A base class for implementing LeaseMaps. This class implements all of the Map methods, and ensures keys and values are of the correct type. The subclass is responsible for implementing the actual LeaseMap methods: canContainKey, renewAll, and cancelAll, and serialization of any subclass state.

See Also:
Serialized Form

Field Summary
protected  java.util.Map map
          Map from Lease to Long(duration), where all leases have the same destination.
 
Constructor Summary
protected AbstractLeaseMap(Lease lease, long duration)
          Default to using a small HashMap.
protected AbstractLeaseMap(java.util.Map map, Lease lease, long duration)
          Provide a map of your choice.
 
Method Summary
protected  void checkKey(java.lang.Object key)
          Check that the key is valid for this map
protected static void checkValue(java.lang.Object value)
          Check that the value is a Long
 void clear()
           
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(java.lang.Object value)
           
 java.util.Set entrySet()
           
 boolean equals(java.lang.Object o)
           
 java.lang.Object get(java.lang.Object key)
           
 int hashCode()
           
 boolean isEmpty()
           
 java.util.Set keySet()
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 void putAll(java.util.Map m)
           
 java.lang.Object remove(java.lang.Object key)
           
 int size()
           
 java.util.Collection values()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

protected final java.util.Map map
Map from Lease to Long(duration), where all leases have the same destination.
Constructor Detail

AbstractLeaseMap

protected AbstractLeaseMap(Lease lease,
                           long duration)
Default to using a small HashMap. It is assumed that canContainKey(lease) is true.

AbstractLeaseMap

protected AbstractLeaseMap(java.util.Map map,
                           Lease lease,
                           long duration)
Provide a map of your choice. It is assumed that canContainKey(lease) is true.
Method Detail

checkKey

protected void checkKey(java.lang.Object key)
Check that the key is valid for this map

checkValue

protected static void checkValue(java.lang.Object value)
Check that the value is a Long

size

public int size()

isEmpty

public boolean isEmpty()

containsKey

public boolean containsKey(java.lang.Object key)

containsValue

public boolean containsValue(java.lang.Object value)

get

public java.lang.Object get(java.lang.Object key)

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)

remove

public java.lang.Object remove(java.lang.Object key)

putAll

public void putAll(java.util.Map m)

clear

public void clear()

keySet

public java.util.Set keySet()

values

public java.util.Collection values()

entrySet

public java.util.Set entrySet()

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 1999 Sun Microsystems, Inc. All rights reserved