E - the type of elements maintained by this setpublic class IndirectSet<E> extends java.lang.Object implements CollectionChangeTracker, java.util.Set<E>, IndirectCollection, java.lang.Cloneable, java.io.Serializable
To use an IndirectSet:
Implementation notes:
CollectionMapping,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
protected int |
initialCapacity
Store initial size for lazy init.
|
protected float |
loadFactor
Store load factor for lazy init.
|
| Constructor and Description |
|---|
IndirectSet()
Construct an empty IndirectSet.
|
IndirectSet(java.util.Collection<? extends E> c)
Construct an IndirectSet containing the elements of the specified collection.
|
IndirectSet(int initialCapacity)
Construct an empty IndirectSet with the specified initial capacity.
|
IndirectSet(int initialCapacity,
float loadFactor)
Construct an empty IndirectSet with the specified initial capacity and
load factor.
|
| Modifier and Type | Method and Description |
|---|---|
java.beans.PropertyChangeListener |
_persistence_getPropertyChangeListener()
INTERNAL:
Return the property change listener for change tracking.
|
void |
_persistence_setPropertyChangeListener(java.beans.PropertyChangeListener changeListener)
INTERNAL:
Set the property change listener for change tracking.
|
boolean |
add(E element) |
boolean |
addAll(java.util.Collection<? extends E> c) |
protected java.util.Set<E> |
buildDelegate()
INTERNAL:
Return the freshly-built delegate.
|
void |
clear() |
void |
clearDeferredChanges()
INTERNAL:
clear any changes that have been deferred to instantiation.
|
java.lang.Object |
clone() |
protected java.util.Set<E> |
cloneDelegate()
INTERNAL:
Clone the delegate.
|
boolean |
contains(java.lang.Object element) |
boolean |
containsAll(java.util.Collection<?> c) |
boolean |
equals(java.lang.Object o) |
void |
forEach(java.util.function.Consumer<? super E> action) |
java.util.Collection<E> |
getAddedElements()
INTERNAL:
Return the elements that have been added before instantiation.
|
protected java.util.Set<E> |
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<E> |
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()
INTERNAL:
Return the valueHolder.
|
boolean |
hasAddedElements()
INTERNAL:
Return if any elements that have been added before instantiation.
|
boolean |
hasBeenRegistered()
INTERNAL:
Return whether this IndirectSet has been registered in a UnitOfWork
|
boolean |
hasDeferredChanges()
INTERNAL:
Return if any elements that have been added or removed before instantiation.
|
int |
hashCode() |
boolean |
hasRemovedElements()
INTERNAL:
Return if any elements that have been removed before instantiation.
|
boolean |
hasTrackedPropertyChangeListener()
INTERNAL:
Return if the collection has a property change listener for change tracking.
|
boolean |
isEmpty() |
boolean |
isInstantiated()
Return whether the contents have been read from the database.
|
protected boolean |
isRelationshipMaintenanceRequired() |
java.util.Iterator<E> |
iterator() |
java.util.stream.Stream<E> |
parallelStream() |
protected void |
raiseAddChangeEvent(java.lang.Object element)
Raise the add change event and relationship maintainence.
|
protected void |
raiseRemoveChangeEvent(java.lang.Object element)
Raise the remove change event.
|
boolean |
remove(java.lang.Object element) |
boolean |
removeAll(java.util.Collection<?> c) |
boolean |
removeIf(java.util.function.Predicate<? super E> filter) |
boolean |
retainAll(java.util.Collection<?> c) |
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.
|
protected boolean |
shouldAvoidInstantiation()
INTERNAL:
Return if add/remove should trigger instantiation or avoid.
|
protected boolean |
shouldUseLazyInstantiation()
Return whether this collection should attempt do deal with adds and removes without retrieving the
collection from the dB
|
int |
size() |
java.util.Spliterator<E> |
spliterator() |
java.util.stream.Stream<E> |
stream() |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
java.lang.String |
toString()
Use the delegate's #toString(); but wrap it with braces to indicate
there is a bit of indirection.
|
protected int initialCapacity
protected float loadFactor
public IndirectSet()
public IndirectSet(int initialCapacity)
initialCapacity - the initial capacity of the setjava.lang.IllegalArgumentException - if the specified initial capacity
is negativepublic IndirectSet(int initialCapacity,
float loadFactor)
initialCapacity - the initial capacity of the setloadFactor - the load factor of the setjava.lang.IllegalArgumentException - if the specified initial capacity
is negativepublic IndirectSet(java.util.Collection<? extends E> c)
c - the initial elements of the setprotected boolean isRelationshipMaintenanceRequired()
public boolean add(E element)
public boolean addAll(java.util.Collection<? extends E> c)
protected java.util.Set<E> buildDelegate()
public void clear()
public void clearDeferredChanges()
clearDeferredChanges in interface IndirectCollectionpublic java.lang.Object clone()
clone in class java.lang.ObjectThis will result in a database query if necessary.protected java.util.Set<E> cloneDelegate()
public boolean contains(java.lang.Object element)
public boolean containsAll(java.util.Collection<?> c)
public boolean equals(java.lang.Object o)
public java.util.Spliterator<E> spliterator()
public java.util.stream.Stream<E> parallelStream()
parallelStream in interface java.util.Collection<E>public java.util.stream.Stream<E> stream()
stream in interface java.util.Collection<E>public boolean removeIf(java.util.function.Predicate<? super E> filter)
removeIf in interface java.util.Collection<E>public void forEach(java.util.function.Consumer<? super E> action)
forEach in interface java.lang.Iterable<E>protected java.util.Set<E> getDelegate()
public java.lang.Object getDelegateObject()
getDelegateObject in interface IndirectCollectionpublic ValueHolderInterface getValueHolder()
getValueHolder in interface IndirectContainerpublic boolean hasBeenRegistered()
public int hashCode()
public boolean isEmpty()
public boolean isInstantiated()
isInstantiated in interface IndirectContainerpublic java.util.Iterator<E> iterator()
public boolean remove(java.lang.Object element)
public boolean removeAll(java.util.Collection<?> c)
public boolean retainAll(java.util.Collection<?> c)
public void setValueHolder(ValueHolderInterface valueHolder)
setValueHolder in interface IndirectContainerpublic void setUseLazyInstantiation(boolean useLazyInstantiation)
setUseLazyInstantiation in interface IndirectCollectionpublic int size()
protected boolean shouldUseLazyInstantiation()
public java.lang.Object[] toArray()
public <T> T[] toArray(T[] a)
public java.lang.String toString()
toString in class java.lang.ObjectAbstractCollection.toString()protected void raiseAddChangeEvent(java.lang.Object element)
protected void raiseRemoveChangeEvent(java.lang.Object element)
public java.beans.PropertyChangeListener _persistence_getPropertyChangeListener()
_persistence_getPropertyChangeListener in interface ChangeTrackerpublic boolean hasTrackedPropertyChangeListener()
public void _persistence_setPropertyChangeListener(java.beans.PropertyChangeListener changeListener)
_persistence_setPropertyChangeListener in interface ChangeTrackerpublic java.lang.String getTrackedAttributeName()
getTrackedAttributeName in interface CollectionChangeTrackerpublic void setTrackedAttributeName(java.lang.String attributeName)
setTrackedAttributeName in interface CollectionChangeTrackerpublic java.util.Collection<E> getRemovedElements()
getRemovedElements in interface IndirectCollectionpublic java.util.Collection<E> getAddedElements()
getAddedElements in interface IndirectCollectionpublic boolean hasAddedElements()
public boolean hasRemovedElements()
public boolean hasDeferredChanges()
hasDeferredChanges in interface IndirectCollectionprotected boolean shouldAvoidInstantiation()