K
- the type of keys maintained by this mapV
- the type of mapped valuespublic class IndirectMap<K,V> extends Hashtable<K,V> implements CollectionChangeTracker, IndirectCollection<Map.Entry<K,V>,Map<K,V>>
To use an IndirectMap:
CollectionMapping
,
IndirectList
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected 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<Map<K,V>> |
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(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 |
---|---|
PropertyChangeListener |
_persistence_getPropertyChangeListener()
Return the property change listener for change tracking.
|
void |
_persistence_setPropertyChangeListener(PropertyChangeListener changeListener)
INTERNAL:
Set the property change listener for change tracking.
|
protected Hashtable<K,V> |
buildDelegate()
Return the freshly-built delegate.
|
void |
clear() |
void |
clearDeferredChanges()
INTERNAL:
clear any changes that have been deferred to instantiation.
|
Object |
clone() |
V |
compute(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction) |
V |
computeIfAbsent(K key,
Function<? super K,? extends V> mappingFunction) |
V |
computeIfPresent(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction) |
boolean |
contains(Object value) |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Enumeration<V> |
elements() |
Set<Map.Entry<K,V>> |
entrySet() |
boolean |
equals(Object o) |
void |
forEach(BiConsumer<? super K,? super V> action) |
V |
get(Object key) |
Collection<Map.Entry<K,V>> |
getAddedElements()
INTERNAL:
Return the elements that have been added before instantiation.
|
protected Hashtable<K,V> |
getDelegate()
INTERNAL:
Check whether the contents have been read from the database.
|
Map<K,V> |
getDelegateObject()
INTERNAL:
Return the real collection object.
|
V |
getOrDefault(Object key,
V defaultValue) |
Collection<Map.Entry<K,V>> |
getRemovedElements()
INTERNAL:
Return the elements that have been removed before instantiation.
|
String |
getTrackedAttributeName()
INTERNAL:
Return the mapping attribute name, used to raise change events.
|
ValueHolderInterface<Map<K,V>> |
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(Map<? extends K,? extends V> m)
Initialize the instance.
|
boolean |
isEmpty() |
boolean |
isInstantiated()
PUBLIC:
Return whether the contents have been read from the database.
|
Enumeration<K> |
keys() |
Set<K> |
keySet() |
V |
merge(K key,
V value,
BiFunction<? super V,? super V,? extends V> remappingFunction) |
V |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> t) |
V |
putIfAbsent(K key,
V value) |
protected void |
raiseAddChangeEvent(Object key,
Object value)
Raise the add change event and relationship maintainence.
|
protected void |
raiseRemoveChangeEvent(Object key,
Object value)
Raise the remove change event.
|
protected void |
rehash() |
V |
remove(Object key) |
boolean |
remove(Object key,
Object value) |
V |
replace(K key,
V value) |
boolean |
replace(K key,
V oldValue,
V newValue) |
void |
replaceAll(BiFunction<? super K,? super V,? extends V> function) |
void |
setTrackedAttributeName(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<Map<K,V>> valueHolder)
INTERNAL:
Set the value holder.
|
int |
size() |
String |
toString()
PUBLIC:
Use the Hashtable.toString(); but wrap it with braces to indicate
there is a bit of indirection.
|
Collection<V> |
values() |
protected volatile ValueHolderInterface<Map<K,V>> 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.0IllegalArgumentException
- if the initial capacity is less
than or equal to zero, or if the load factor is less than
or equal to zeropublic IndirectMap(Map<? extends K,? extends V> m)
m
- a map containing the mappings to usepublic void clear()
public void clearDeferredChanges()
clearDeferredChanges
in interface IndirectCollection<Map.Entry<K,V>,Map<K,V>>
public Object clone()
clone
in class Hashtable<K,V>
This will result in a database query if necessary.
public boolean contains(Object value)
contains
in class Hashtable<K,V>
Hashtable.contains(java.lang.Object)
public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
containsKey
in class Hashtable<K,V>
Hashtable.containsKey(java.lang.Object)
public boolean containsValue(Object value)
containsValue
in interface Map<K,V>
containsValue
in class Hashtable<K,V>
Hashtable.containsValue(java.lang.Object)
public Enumeration<V> elements()
elements
in class Hashtable<K,V>
Hashtable.elements()
public boolean equals(Object o)
protected Hashtable<K,V> getDelegate()
public Map<K,V> getDelegateObject()
getDelegateObject
in interface IndirectCollection<Map.Entry<K,V>,Map<K,V>>
public String getTrackedAttributeName()
getTrackedAttributeName
in interface CollectionChangeTracker
public PropertyChangeListener _persistence_getPropertyChangeListener()
_persistence_getPropertyChangeListener
in interface ChangeTracker
public ValueHolderInterface<Map<K,V>> getValueHolder()
getValueHolder
in interface IndirectContainer<Map<K,V>>
public int hashCode()
public boolean hasTrackedPropertyChangeListener()
protected void initialize(int initialCapacity, float loadFactor)
public boolean isEmpty()
public boolean isInstantiated()
isInstantiated
in interface IndirectContainer<Map<K,V>>
public Enumeration<K> keys()
keys
in class Hashtable<K,V>
Hashtable.keys()
public V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)
computeIfAbsent
in interface Map<K,V>
computeIfAbsent
in class Hashtable<K,V>
public V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
computeIfPresent
in interface Map<K,V>
computeIfPresent
in class Hashtable<K,V>
public void forEach(BiConsumer<? super K,? super V> action)
public V getOrDefault(Object key, V defaultValue)
getOrDefault
in interface Map<K,V>
getOrDefault
in class Hashtable<K,V>
public V putIfAbsent(K key, V value)
putIfAbsent
in interface Map<K,V>
putIfAbsent
in class Hashtable<K,V>
public void replaceAll(BiFunction<? super K,? super V,? extends V> function)
replaceAll
in interface Map<K,V>
replaceAll
in class Hashtable<K,V>
protected void rehash()
rehash
in class Hashtable<K,V>
Hashtable.rehash()
protected void raiseAddChangeEvent(Object key, Object value)
protected void raiseRemoveChangeEvent(Object key, Object value)
public void setTrackedAttributeName(String attributeName)
setTrackedAttributeName
in interface CollectionChangeTracker
public void _persistence_setPropertyChangeListener(PropertyChangeListener changeListener)
_persistence_setPropertyChangeListener
in interface ChangeTracker
public void setValueHolder(ValueHolderInterface<Map<K,V>> valueHolder)
setValueHolder
in interface IndirectContainer<Map<K,V>>
public int size()
public void setUseLazyInstantiation(boolean useLazyInstantiation)
setUseLazyInstantiation
in interface IndirectCollection<Map.Entry<K,V>,Map<K,V>>
public Collection<Map.Entry<K,V>> getRemovedElements()
getRemovedElements
in interface IndirectCollection<Map.Entry<K,V>,Map<K,V>>
public Collection<Map.Entry<K,V>> getAddedElements()
getAddedElements
in interface IndirectCollection<Map.Entry<K,V>,Map<K,V>>
public boolean hasDeferredChanges()
hasDeferredChanges
in interface IndirectCollection<Map.Entry<K,V>,Map<K,V>>
public String toString()
toString
in class Hashtable<K,V>
Hashtable.toString()
Copyright © 2007–2020 Eclipse.org - EclipseLink Project. All rights reserved.