|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.odi.util.OSDictionary | +--com.odi.util.OSHashtable | +--com.odi.util.OSHashMap
OSHashMap implements the java.util.Map interface with a persistent hash table. Certain operations on OSHashMap that require comparison of objects might cause ObjectStore to throw ReferencedObjectNotFoundException. If this occurs, it indicates that one or more of the key or value objects referenced by the hash table cannot be accessed, most likely because they have been destroyed. The OSHashMap class provides a clearDestroyed() operation that can be used to remove entries that contain these references to these destroyed objects.
Additional information about OSHashMap is in the user guide. Here are exceptions that might be thrown by many of the methods in this class:
DatabaseNotOpenException If the database containing the object is not open.
NoTransactionInProgressException If there is no transaction in progress.
ObjectNotFoundException If the object was not found, either because the object itself, its segment, or its database was destroyed.
ObjectException Ifthe object was local and was fetched in a previous transaction.
ObjectStoreException If the session implied by an argument to the call or the object the method is called on is not the same as the session associated with the current thread.
UpdateReadOnlyException If there is a readonly transaction in progress or if the database is open for readonly.
Inner classes inherited from class java.util.Map |
java.util.Map.Entry |
Constructor Summary | |
OSHashMap()
Constructs a new persistence-capable hash map. |
|
OSHashMap(int initialCapacity)
Constructs a new persistence-capable hash map. |
Method Summary | |
void |
clear()
Removes all entries from the hash table. |
boolean |
equals(java.lang.Object obj)
Compares the specified Object with this Map for equality. |
int |
hashCode()
Returns the hash code value for this Map. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Enters the mapping of a key to a value in the hash table. |
java.lang.Object |
remove(java.lang.Object key)
Removes any existing mapping at the specified key. |
boolean |
removeValue(java.lang.Object value)
Removes the specified value from the hashtable. |
Methods inherited from class com.odi.util.OSHashtable |
clearContents, clearDestroyed, clone, contains, containsKey, containsKey, containsValue, destroy, elements, entries, entrySet, flushContents, get, get, getKey, getKey, initializeContents, isEmpty, keys, keySet, putAll, rehash, resize, setLoadFactor, size, toString, values |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
containsKey, containsValue, entrySet, get, isEmpty, keySet, putAll, size, values |
Methods inherited from interface com.odi.IPersistentHooks |
postInitializeContents, preClearContents, preDestroyPersistent, preFlushContents |
Methods inherited from interface com.odi.IPersistent |
ODIgetRef, ODIgetState, ODIsetRef, ODIsetState |
Constructor Detail |
public OSHashMap(int initialCapacity)
initialCapacity
- The initial expected capacity requirement
for the hash table.public OSHashMap()
Method Detail |
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in interface java.util.Map
put
in class OSHashtable
key
- The identifier for the value.
value
- The value being stored in the hash table.
NullPointerException
- If either key or value
is null.ReferencedObjectNotFoundException
- If an entry key
is not found.public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map
remove
in class OSHashtable
key
- The key of the object to remove.
NullPointerException
- If key is null.ReferencedObjectNotFoundException
- If an entry key
is not found.public boolean removeValue(java.lang.Object value)
removeValue
in class OSHashtable
value
- The element to search for, which must be nonnull.
NullPointerException
- If value is null.ReferencedObjectNotFoundException
- If an entry value
is not found.public void clear()
clear
in interface java.util.Map
clear
in class OSHashtable
public boolean equals(java.lang.Object obj)
t1
and t2
represent the same mappings
if t1.keySet().equals(t2.keySet())
and for every
key k
in t1.keySet()
,
(t1.get(k)==null ? t2.get(k)==null : t1.get(k).equals(t2.get(k)))
. Note that this meets the JDK1.2 specification for
Map.equals, but that it means that it is not appropriate to store
an instance of OSHashMap in any hash-based collection, because its
hash code will change if the OSHashMap is modified.equals
in interface java.util.Map
equals
in class java.lang.Object
o
- Object to be compared for equality with this Map.public int hashCode()
t1.equals(t2)
implies
that t1.hashCode()==t2.hashCode()
for any two Maps
t1
and t2
, as required by the general
contract of Object.hashCode.
Note that this meets the JDK1.2 specification for
Map.equals, but that it means that it is not appropriate to store
an instance of OSHashMap in any hash-based collection, because its
hash code will change if the OSHashMap is modified. If the com.odi.debugHashCodes system property is set to true, and this method is called from a thread which is not associated with a session, then the method returns an arbitrary value instead of throwing com.odi.NoSessionException. Use this system property setting to permit Java debuggers to print instances of this class.
hashCode
in interface java.util.Map
hashCode
in class OSDictionary
Object.hashCode()
,
Object.equals(java.lang.Object)
,
Map.equals(java.lang.Object)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |