public abstract class AbstractLRSProxyCollection extends Object implements Set, LRSProxy, org.apache.commons.collections4.Predicate, CollectionChangeTracker
iterator()
may perform a database
query. Changes to the collection are tracked through a
ChangeTracker
. This collection has the following limitations:
size
method may return Integer.MAX_VALUE
.Constructor and Description |
---|
AbstractLRSProxyCollection(Class elementType,
boolean ordered)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(Object o) |
boolean |
addAll(Collection all) |
void |
added(Object val)
Record that the given element was added.
|
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection all) |
Object |
copy(Object orig)
Return an unproxied copy of the given instance.
|
protected abstract int |
count()
Return the number of elements in the collection, or
Integer.MAX_VALUE . |
boolean |
evaluate(Object o) |
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.
|
protected abstract boolean |
has(Object o)
Return whether the collection contains the given element.
|
boolean |
isEmpty() |
boolean |
isTracking()
Return true if this tracker has an up-to-date view of all the changes
to the container it is managing.
|
Iterator |
iterator() |
protected abstract Iterator |
itr()
Implement this method to return an iterator over the contents of the
collection.
|
boolean |
remove(Object o) |
boolean |
removeAll(Collection all) |
void |
removed(Object val)
Record that the given element was removed.
|
boolean |
retainAll(Collection all) |
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.
|
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.
|
Object[] |
toArray() |
Object[] |
toArray(Object[] a) |
protected Object |
writeReplace() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals, hashCode, spliterator
parallelStream, removeIf, stream
public AbstractLRSProxyCollection(Class elementType, boolean ordered)
elementType
- the allowed type of elements, or null for no
restrictionsordered
- true if this collection is orderedpublic void setOwner(OpenJPAStateManager sm, int field)
Proxy
public OpenJPAStateManager getOwner()
Proxy
public int getOwnerField()
Proxy
getOwnerField
in interface Proxy
public ChangeTracker getChangeTracker()
Proxy
getChangeTracker
in interface Proxy
public Object copy(Object orig)
Proxy
public boolean add(Object o)
add
in interface Collection
add
in interface Set
public boolean addAll(Collection all)
addAll
in interface Collection
addAll
in interface Set
public boolean remove(Object o)
remove
in interface Collection
remove
in interface Set
public boolean removeAll(Collection all)
removeAll
in interface Collection
removeAll
in interface Set
public boolean retainAll(Collection all)
retainAll
in interface Collection
retainAll
in interface Set
public void clear()
clear
in interface Collection
clear
in interface Set
public boolean contains(Object o)
contains
in interface Collection
contains
in interface Set
public boolean containsAll(Collection all)
containsAll
in interface Collection
containsAll
in interface Set
public Object[] toArray()
toArray
in interface Collection
toArray
in interface Set
public Object[] toArray(Object[] a)
toArray
in interface Collection
toArray
in interface Set
public int size()
size
in interface Collection
size
in interface Set
public boolean isEmpty()
isEmpty
in interface Collection
isEmpty
in interface Set
public Iterator iterator()
protected Object writeReplace() throws ObjectStreamException
ObjectStreamException
protected abstract Iterator itr()
Iterator.remove()
method,
and may implement Closeable
.protected abstract boolean has(Object o)
protected abstract int count()
Integer.MAX_VALUE
.public boolean evaluate(Object o)
evaluate
in interface org.apache.commons.collections4.Predicate
public boolean isTracking()
ChangeTracker
isTracking
in interface ChangeTracker
public void startTracking()
ChangeTracker
startTracking
in interface ChangeTracker
public void stopTracking()
ChangeTracker
stopTracking
in interface ChangeTracker
public Collection getAdded()
ChangeTracker
getAdded
in interface ChangeTracker
public Collection getRemoved()
ChangeTracker
getRemoved
in interface ChangeTracker
public Collection getChanged()
ChangeTracker
getChanged
in interface ChangeTracker
public void added(Object val)
CollectionChangeTracker
added
in interface CollectionChangeTracker
public void removed(Object val)
CollectionChangeTracker
removed
in interface CollectionChangeTracker
public int getNextSequence()
ChangeTracker
getNextSequence
in interface ChangeTracker
public void setNextSequence(int seq)
ChangeTracker
setNextSequence
in interface ChangeTracker
Copyright © 2006–2019 Apache Software Foundation. All rights reserved.