|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.openjpa.util.AbstractLRSProxyMap<K,V>
public abstract class AbstractLRSProxyMap<K,V>
A map proxy designed for maps backed by extremely large result sets in
which each call to get(java.lang.Object) or containsKey(java.lang.Object) may perform a
database query. Changes to the map are tracked through a
ChangeTracker. This map has the following limitations:
size method may return Integer.MAX_VALUE.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Constructor Summary | |
|---|---|
AbstractLRSProxyMap(Class<K> keyType,
Class<V> valueType)
|
|
| Method Summary | |
|---|---|
void |
added(Object key,
Object val)
Record that the given entry was added to the map. |
void |
changed(Object key,
Object orig,
Object val)
Record that the given entry was altered. |
void |
clear()
|
boolean |
containsKey(Object key)
|
boolean |
containsValue(Object val)
|
Object |
copy(Object orig)
Return an unproxied copy of the given instance. |
protected abstract int |
count()
Return the number of entries in the map, or Integer.MAX_VALUE. |
Set<Map.Entry<K,V>> |
entrySet()
|
boolean |
evaluate(Object obj)
|
V |
get(Object key)
|
Collection |
getAdded()
Return the collection of values that need to be added to the managed container. |
Collection |
getChanged()
Return the set of elements that have changed. |
ChangeTracker |
getChangeTracker()
Return the change tracker for this proxy, or null if none. |
int |
getNextSequence()
The next element sequence value for this proxy at load time. |
OpenJPAStateManager |
getOwner()
Return the owning object. |
int |
getOwnerField()
Return the owning field index. |
Collection |
getRemoved()
Return the set of values that need to be removed from the managed container. |
boolean |
getTrackKeys()
Whether to track keys or values. |
protected abstract boolean |
hasKey(Object key)
Return whether the given key exists in the map. |
protected abstract boolean |
hasValue(Object value)
Return whether the given value exists in the map. |
boolean |
isEmpty()
|
(package private) boolean |
isIterated()
used in testing; we need to be able to make sure that OpenJPA does not iterate lrs fields during standard crud operations |
boolean |
isTracking()
Return true if this tracker has an up-to-date view of all the changes to the container it is managing. |
protected abstract Iterator<?> |
itr()
Implement this method to return an iterator over the entries in the map. |
protected abstract Collection<K> |
keys(Object value)
Return all keys for the given value. |
Set<K> |
keySet()
|
V |
put(K key,
V value)
|
void |
putAll(Map<? extends K,? extends V> m)
|
V |
remove(Object key)
|
void |
removed(Object key,
Object val)
Record that the given entry was removed from the map. |
(package private) void |
setIterated(boolean it)
used in testing; we need to be able to make sure that OpenJPA does not iterate lrs fields during standard crud operations |
void |
setNextSequence(int seq)
The maximum element sequence value for this proxy at load time. |
void |
setOwner(OpenJPAStateManager sm,
int field)
Reset the state of the proxy, and set the owning instance of the proxy and the name of the field it is assigned to. |
void |
setTrackKeys(boolean keys)
Whether to track keys or values. |
int |
size()
|
void |
startTracking()
Reset the state of the change tracker, and turn change tracking back on if it has been disabled. |
void |
stopTracking()
Tell the tracker to stop tracking changes for its container. |
protected abstract V |
value(Object key)
Return the value of the given key. |
Collection<V> |
values()
|
protected Object |
writeReplace()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public AbstractLRSProxyMap(Class<K> keyType,
Class<V> valueType)
| Method Detail |
|---|
public void setOwner(OpenJPAStateManager sm,
int field)
Proxy
setOwner in interface Proxypublic OpenJPAStateManager getOwner()
Proxy
getOwner in interface Proxypublic int getOwnerField()
Proxy
getOwnerField in interface Proxypublic ChangeTracker getChangeTracker()
Proxy
getChangeTracker in interface Proxypublic Object copy(Object orig)
Proxy
copy in interface Proxyboolean isIterated()
void setIterated(boolean it)
public int size()
size in interface Map<K,V>public boolean isEmpty()
isEmpty in interface Map<K,V>public boolean containsKey(Object key)
containsKey in interface Map<K,V>public boolean containsValue(Object val)
containsValue in interface Map<K,V>public V get(Object key)
get in interface Map<K,V>
public V put(K key,
V value)
put in interface Map<K,V>public void putAll(Map<? extends K,? extends V> m)
putAll in interface Map<K,V>public V remove(Object key)
remove in interface Map<K,V>public void clear()
clear in interface Map<K,V>public Set<K> keySet()
keySet in interface Map<K,V>public Collection<V> values()
values in interface Map<K,V>public Set<Map.Entry<K,V>> entrySet()
entrySet in interface Map<K,V>
protected Object writeReplace()
throws ObjectStreamException
ObjectStreamExceptionprotected abstract boolean hasKey(Object key)
protected abstract boolean hasValue(Object value)
protected abstract Collection<K> keys(Object value)
protected abstract V value(Object key)
protected abstract Iterator<?> itr()
Map.Entry interface. This method may be invoked multiple
times. The iterator does not have to support the
Iterator.remove() method, and may implement
Closeable.
protected abstract int count()
Integer.MAX_VALUE.
public boolean evaluate(Object obj)
evaluate in interface org.apache.commons.collections.Predicatepublic boolean isTracking()
ChangeTracker
isTracking in interface ChangeTrackerpublic void startTracking()
ChangeTracker
startTracking in interface ChangeTrackerpublic void stopTracking()
ChangeTracker
stopTracking in interface ChangeTrackerpublic boolean getTrackKeys()
MapChangeTracker
getTrackKeys in interface MapChangeTrackerpublic void setTrackKeys(boolean keys)
MapChangeTracker
setTrackKeys in interface MapChangeTrackerpublic Collection getAdded()
ChangeTracker
getAdded in interface ChangeTrackerpublic Collection getRemoved()
ChangeTracker
getRemoved in interface ChangeTrackerpublic Collection getChanged()
ChangeTracker
getChanged in interface ChangeTracker
public void added(Object key,
Object val)
MapChangeTracker
added in interface MapChangeTracker
public void removed(Object key,
Object val)
MapChangeTracker
removed in interface MapChangeTracker
public void changed(Object key,
Object orig,
Object val)
MapChangeTracker
changed in interface MapChangeTrackerpublic int getNextSequence()
ChangeTracker
getNextSequence in interface ChangeTrackerpublic void setNextSequence(int seq)
ChangeTracker
setNextSequence in interface ChangeTracker
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||