K
- the type of keys maintained by this mapV
- the type of mapped valuespublic class IndirectMap<K,V> extends java.util.Hashtable<K,V> implements CollectionChangeTracker, IndirectCollection
To use an IndirectMap:
CollectionMapping
,
IndirectList
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected java.util.Hashtable<K,V> |
delegate
Reduce type casting
|
protected int |
initialCapacity
Store initial size for lazy init.
|
protected float |
loadFactor
Store load factor for lazy init.
|
protected ValueHolderInterface |
valueHolder
Delegate indirection behavior to a value holder
|
Constructor and Description |
---|
IndirectMap()
PUBLIC:
Construct a new, empty IndirectMap with a default
capacity and load factor.
|
IndirectMap(int initialCapacity)
PUBLIC:
Construct a new, empty IndirectMap with the specified initial capacity
and default load factor.
|
IndirectMap(int initialCapacity,
float loadFactor)
PUBLIC:
Construct a new, empty IndirectMap with the specified initial
capacity and load factor.
|
IndirectMap(java.util.Map<? extends K,? extends V> m)
PUBLIC:
Construct a new IndirectMap with the same mappings as the given Map.
|
Modifier and Type | Method and Description |
---|---|
java.beans.PropertyChangeListener |
_persistence_getPropertyChangeListener()
Return the property change listener for change tracking.
|
void |
_persistence_setPropertyChangeListener(java.beans.PropertyChangeListener changeListener)
INTERNAL:
Set the property change listener for change tracking.
|
protected java.util.Hashtable<K,V> |
buildDelegate()
Return the freshly-built delegate.
|
void |
clear() |
void |
clearDeferredChanges()
INTERNAL:
clear any changes that have been deferred to instantiation.
|
java.lang.Object |
clone() |
boolean |
contains(java.lang.Object value) |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
java.util.Enumeration<V> |
elements() |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet() |
boolean |
equals(java.lang.Object o) |
V |
get(java.lang.Object key) |
java.util.Collection |
getAddedElements()
INTERNAL:
Return the elements that have been added before instantiation.
|
protected java.util.Hashtable<K,V> |
getDelegate()
INTERNAL:
Check whether the contents have been read from the database.
|
java.lang.Object |
getDelegateObject()
INTERNAL:
Return the real collection object.
|
java.util.Collection |
getRemovedElements()
INTERNAL:
Return the elements that have been removed before instantiation.
|
java.lang.String |
getTrackedAttributeName()
INTERNAL:
Return the mapping attribute name, used to raise change events.
|
ValueHolderInterface |
getValueHolder()
PUBLIC:
Return the valueHolder.
|
boolean |
hasDeferredChanges()
INTERNAL:
Return if any elements that have been added or removed before instantiation.
|
int |
hashCode() |
boolean |
hasTrackedPropertyChangeListener()
INTERNAL:
Return if the collection has a property change listener for change tracking.
|
protected void |
initialize(int initialCapacity,
float loadFactor)
Initialize the instance.
|
protected void |
initialize(java.util.Map<? extends K,? extends V> m)
Initialize the instance.
|
boolean |
isEmpty() |
boolean |
isInstantiated()
PUBLIC:
Return whether the contents have been read from the database.
|
java.util.Enumeration<K> |
keys() |
java.util.Set<K> |
keySet() |
V |
put(K key,
V value) |
void |
putAll(java.util.Map<? extends K,? extends V> t) |
protected void |
raiseAddChangeEvent(java.lang.Object key,
java.lang.Object value)
Raise the add change event and relationship maintainence.
|
protected void |
raiseRemoveChangeEvent(java.lang.Object key,
java.lang.Object value)
Raise the remove change event.
|
protected void |
rehash() |
V |
remove(java.lang.Object key) |
void |
setTrackedAttributeName(java.lang.String attributeName)
INTERNAL:
Set the mapping attribute name, used to raise change events.
|
void |
setUseLazyInstantiation(boolean useLazyInstantiation)
INTERNAL
Set whether this collection should attempt do deal with adds and removes without retrieving the
collection from the dB
|
void |
setValueHolder(ValueHolderInterface valueHolder)
INTERNAL:
Set the value holder.
|
int |
size() |
java.lang.String |
toString()
PUBLIC:
Use the Hashtable.toString(); but wrap it with braces to indicate
there is a bit of indirection.
|
java.util.Collection<V> |
values() |
protected ValueHolderInterface valueHolder
protected int initialCapacity
protected float loadFactor
public IndirectMap()
public IndirectMap(int initialCapacity)
initialCapacity
- the initial capacity of the hashtablepublic IndirectMap(int initialCapacity, float loadFactor)
initialCapacity
- the initial capacity of the hashtableloadFactor
- a number between 0.0 and 1.0java.lang.IllegalArgumentException
- if the initial capacity is less
than or equal to zero, or if the load factor is less than
or equal to zeropublic IndirectMap(java.util.Map<? extends K,? extends V> m)
m
- a map containing the mappings to usepublic void clear()
public void clearDeferredChanges()
clearDeferredChanges
in interface IndirectCollection
public java.lang.Object clone()
public boolean contains(java.lang.Object value)
public boolean containsKey(java.lang.Object key)
public boolean containsValue(java.lang.Object value)
public java.util.Enumeration<V> elements()
public boolean equals(java.lang.Object o)
public V get(java.lang.Object key)
protected java.util.Hashtable<K,V> getDelegate()
public java.lang.Object getDelegateObject()
getDelegateObject
in interface IndirectCollection
public java.lang.String getTrackedAttributeName()
getTrackedAttributeName
in interface CollectionChangeTracker
public java.beans.PropertyChangeListener _persistence_getPropertyChangeListener()
_persistence_getPropertyChangeListener
in interface ChangeTracker
public ValueHolderInterface getValueHolder()
getValueHolder
in interface IndirectContainer
public int hashCode()
public boolean hasTrackedPropertyChangeListener()
protected void initialize(int initialCapacity, float loadFactor)
protected void initialize(java.util.Map<? extends K,? extends V> m)
public boolean isEmpty()
public boolean isInstantiated()
isInstantiated
in interface IndirectContainer
public java.util.Enumeration<K> keys()
public java.util.Set<K> keySet()
protected void rehash()
protected void raiseAddChangeEvent(java.lang.Object key, java.lang.Object value)
protected void raiseRemoveChangeEvent(java.lang.Object key, java.lang.Object value)
public V remove(java.lang.Object key)
public void setTrackedAttributeName(java.lang.String attributeName)
setTrackedAttributeName
in interface CollectionChangeTracker
public void _persistence_setPropertyChangeListener(java.beans.PropertyChangeListener changeListener)
_persistence_setPropertyChangeListener
in interface ChangeTracker
public void setValueHolder(ValueHolderInterface valueHolder)
setValueHolder
in interface IndirectContainer
public int size()
public void setUseLazyInstantiation(boolean useLazyInstantiation)
setUseLazyInstantiation
in interface IndirectCollection
public java.util.Collection getRemovedElements()
getRemovedElements
in interface IndirectCollection
public java.util.Collection getAddedElements()
getAddedElements
in interface IndirectCollection
public boolean hasDeferredChanges()
hasDeferredChanges
in interface IndirectCollection
public java.lang.String toString()