org.apache.openjpa.lib.util
Class ReferenceHashMap
java.lang.Object
java.util.AbstractMap
org.apache.commons.collections.map.AbstractHashedMap
org.apache.commons.collections.map.AbstractReferenceMap
org.apache.commons.collections.map.ReferenceMap
org.apache.openjpa.lib.util.ReferenceHashMap
- All Implemented Interfaces:
- java.io.Serializable, java.util.Map, org.apache.commons.collections.IterableMap, ReferenceMap, SizedMap
public class ReferenceHashMap
- extends org.apache.commons.collections.map.ReferenceMap
- implements ReferenceMap, SizedMap
Map in which the key, value, or both may be weak/soft references.
- Since:
- 0.4.0
- Author:
- Abe White
- See Also:
- Serialized Form
Nested classes/interfaces inherited from class org.apache.commons.collections.map.AbstractReferenceMap |
org.apache.commons.collections.map.AbstractReferenceMap.ReferenceEntry |
Nested classes/interfaces inherited from class org.apache.commons.collections.map.AbstractHashedMap |
org.apache.commons.collections.map.AbstractHashedMap.EntrySet, org.apache.commons.collections.map.AbstractHashedMap.EntrySetIterator, org.apache.commons.collections.map.AbstractHashedMap.HashEntry, org.apache.commons.collections.map.AbstractHashedMap.HashIterator, org.apache.commons.collections.map.AbstractHashedMap.HashMapIterator, org.apache.commons.collections.map.AbstractHashedMap.KeySet, org.apache.commons.collections.map.AbstractHashedMap.KeySetIterator, org.apache.commons.collections.map.AbstractHashedMap.Values, org.apache.commons.collections.map.AbstractHashedMap.ValuesIterator |
Nested classes/interfaces inherited from interface java.util.Map |
java.util.Map.Entry<K,V> |
Nested classes/interfaces inherited from interface java.util.Map |
java.util.Map.Entry<K,V> |
Fields inherited from class org.apache.commons.collections.map.AbstractReferenceMap |
HARD, keyType, purgeValues, SOFT, valueType, WEAK |
Fields inherited from class org.apache.commons.collections.map.AbstractHashedMap |
data, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_THRESHOLD, entrySet, GETKEY_INVALID, GETVALUE_INVALID, keySet, loadFactor, MAXIMUM_CAPACITY, modCount, NO_NEXT_ENTRY, NO_PREVIOUS_ENTRY, NULL, REMOVE_INVALID, SETVALUE_INVALID, size, threshold, values |
Method Summary |
protected void |
addMapping(int hashIndex,
int hashCode,
java.lang.Object key,
java.lang.Object value)
|
protected org.apache.commons.collections.map.AbstractHashedMap.HashEntry |
createEntry(org.apache.commons.collections.map.AbstractHashedMap.HashEntry next,
int hashCode,
java.lang.Object key,
java.lang.Object value)
|
protected void |
doReadObject(java.io.ObjectInputStream in)
|
protected void |
doWriteObject(java.io.ObjectOutputStream out)
|
int |
getMaxSize()
The maximum number of entries, or Integer.MAX_VALUE for no limit. |
boolean |
isFull()
Whether the map is full. |
void |
keyExpired(java.lang.Object value)
Overridable callback for when a key reference expires. |
void |
overflowRemoved(java.lang.Object key,
java.lang.Object value)
Overridable callback for when an overflow entry is automatically removed. |
protected void |
purge(java.lang.ref.Reference ref)
|
void |
removeExpired()
Purge stale entries. |
void |
setMaxSize(int maxSize)
The maximum number of entries, or Integer.MAX_VALUE for no limit. |
void |
valueExpired(java.lang.Object key)
Overridable callback for when a value reference expires. |
Methods inherited from class org.apache.commons.collections.map.AbstractReferenceMap |
clear, containsKey, containsValue, createEntrySetIterator, createKeySetIterator, createValuesIterator, entrySet, get, getEntry, hashEntry, init, isEmpty, isEqualKey, keySet, mapIterator, purge, purgeBeforeRead, purgeBeforeWrite, put, remove, size, values |
Methods inherited from class org.apache.commons.collections.map.AbstractHashedMap |
addEntry, calculateNewCapacity, calculateThreshold, checkCapacity, clone, convertKey, destroyEntry, ensureCapacity, entryHashCode, entryKey, entryNext, entryValue, equals, hash, hashCode, hashIndex, isEqualValue, putAll, removeEntry, removeMapping, reuseEntry, toString, updateEntry |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
Methods inherited from interface java.util.Map |
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
ReferenceHashMap
public ReferenceHashMap(int keyType,
int valueType)
ReferenceHashMap
public ReferenceHashMap(int keyType,
int valueType,
int capacity,
float loadFactor)
getMaxSize
public int getMaxSize()
- Description copied from interface:
SizedMap
- The maximum number of entries, or Integer.MAX_VALUE for no limit.
- Specified by:
getMaxSize
in interface SizedMap
setMaxSize
public void setMaxSize(int maxSize)
- Description copied from interface:
SizedMap
- The maximum number of entries, or Integer.MAX_VALUE for no limit.
- Specified by:
setMaxSize
in interface SizedMap
isFull
public boolean isFull()
- Description copied from interface:
SizedMap
- Whether the map is full.
- Specified by:
isFull
in interface SizedMap
overflowRemoved
public void overflowRemoved(java.lang.Object key,
java.lang.Object value)
- Description copied from interface:
SizedMap
- Overridable callback for when an overflow entry is automatically removed.
- Specified by:
overflowRemoved
in interface SizedMap
valueExpired
public void valueExpired(java.lang.Object key)
- Description copied from interface:
ReferenceMap
- Overridable callback for when a value reference expires.
- Specified by:
valueExpired
in interface ReferenceMap
- Parameters:
key
- the key for the expired value
keyExpired
public void keyExpired(java.lang.Object value)
- Description copied from interface:
ReferenceMap
- Overridable callback for when a key reference expires.
- Specified by:
keyExpired
in interface ReferenceMap
- Parameters:
value
- the value for the expired key
removeExpired
public void removeExpired()
- Description copied from interface:
ReferenceMap
- Purge stale entries.
- Specified by:
removeExpired
in interface ReferenceMap
addMapping
protected void addMapping(int hashIndex,
int hashCode,
java.lang.Object key,
java.lang.Object value)
- Overrides:
addMapping
in class org.apache.commons.collections.map.AbstractHashedMap
createEntry
protected org.apache.commons.collections.map.AbstractHashedMap.HashEntry createEntry(org.apache.commons.collections.map.AbstractHashedMap.HashEntry next,
int hashCode,
java.lang.Object key,
java.lang.Object value)
- Overrides:
createEntry
in class org.apache.commons.collections.map.AbstractReferenceMap
purge
protected void purge(java.lang.ref.Reference ref)
- Overrides:
purge
in class org.apache.commons.collections.map.AbstractReferenceMap
doWriteObject
protected void doWriteObject(java.io.ObjectOutputStream out)
throws java.io.IOException
- Overrides:
doWriteObject
in class org.apache.commons.collections.map.AbstractReferenceMap
- Throws:
java.io.IOException
doReadObject
protected void doReadObject(java.io.ObjectInputStream in)
throws java.lang.ClassNotFoundException,
java.io.IOException
- Overrides:
doReadObject
in class org.apache.commons.collections.map.AbstractReferenceMap
- Throws:
java.lang.ClassNotFoundException
java.io.IOException
Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.