public final class BeanSet<E> extends Object implements Set<E>, BeanCollectionAdd
BeanCollection.ModifyListenMode
Constructor and Description |
---|
BeanSet()
Create using an underlying LinkedHashSet.
|
BeanSet(BeanCollectionLoader loader,
EntityBean ownerBean,
String propertyName) |
BeanSet(Set<E> set)
Create with a specific Set implementation.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(E o) |
boolean |
addAll(Collection<? extends E> addCollection) |
void |
addBean(E bean)
Add a bean to the list/set with modifyListen notification.
|
void |
addEntityBean(EntityBean bean)
Add a loaded bean to the collection.
|
boolean |
checkEmptyLazyLoad()
Check after the lazy load that the underlying collection is not null
(handle case where join to many not outer).
|
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
boolean |
equals(Object obj)
Equal if obj is a Set and equal in a Set sense.
|
Collection<E> |
getActualDetails()
Returns the underlying collection of beans from the Set, Map or List.
|
Collection<?> |
getActualEntries()
Returns the underlying entries so for Maps this is a collection of
Map.Entry.
|
Set<E> |
getActualSet()
Return the actual underlying set.
|
ExpressionList<?> |
getFilterMany()
Return the filter (if any) that was used in building this collection.
|
Set<E> |
getModifyAdditions()
Return the list of objects added to the list set or map.
|
BeanCollection.ModifyListenMode |
getModifyListening()
Return the current modify listening mode.
|
BeanCollection.ModifyListenMode |
getModifyListenMode()
Return the modify listening mode this collection is using.
|
Set<E> |
getModifyRemovals()
Return the list of objects removed from the list set or map.
|
EntityBean |
getOwnerBean()
Return the bean that owns this collection.
|
String |
getPropertyName()
Return the bean property name this collection represents.
|
BeanCollection<E> |
getShallowCopy()
Return a shallow copy of this collection that is modifiable.
|
int |
hashCode() |
boolean |
holdsModifications()
Return true if there are underlying additions or removals.
|
void |
internalAdd(Object bean)
Add the bean to the collection.
|
void |
internalAddWithCheck(Object bean)
Add the bean with a check to see if it is already contained.
|
boolean |
isEmpty()
Return true if the List Set or Map is empty.
|
boolean |
isPopulated()
Returns true if the underlying set has its data.
|
boolean |
isReadOnly()
Return true if the collection should be treated as readOnly and no elements
can be added or removed etc.
|
boolean |
isReference()
Return true if this is a reference (lazy loading) bean collection.
|
boolean |
isRegisteredWithLoadContext()
Return true if the collection has been registered with the batch loading context.
|
boolean |
isSkipSave()
Return true if the collection is uninitialised or is empty without any held modifications.
|
Iterator<E> |
iterator() |
void |
loadFrom(BeanCollection<?> other)
Load bean from another collection.
|
void |
modifyAddition(E bean)
Add an object to the additions list.
|
void |
modifyRemoval(Object bean)
Add an object to the deletions list.
|
void |
modifyReset()
Reset the set of additions and deletions.
|
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> beans) |
void |
removeBean(E bean)
Remove a bean to the list/set with modifyListen notification.
|
void |
reset(EntityBean ownerBean,
String propertyName)
Reset the collection back to an empty state ready for reloading.
|
boolean |
retainAll(Collection<?> beans) |
void |
setActualSet(Set<?> set)
Set the underlying set (used for lazy fetch).
|
void |
setDisableLazyLoad(boolean disableLazyLoad)
Set the disableLazyLoad state.
|
void |
setFilterMany(ExpressionList<?> filterMany)
Set the filter that was used in building this collection.
|
void |
setLoader(BeanCollectionLoader loader)
Set the loader that will be used to lazy/query load this collection.
|
void |
setModifyListening(BeanCollection.ModifyListenMode mode)
set modifyListening to be on or off.
|
void |
setReadOnly(boolean readOnly)
Set to true if you want the BeanCollection to be treated as read only.
|
int |
size()
Return the number of elements in the List Set or Map.
|
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
String |
toString() |
boolean |
wasTouched()
Has been modified by an addition or removal.
|
spliterator
parallelStream, removeIf, stream
public BeanSet()
public BeanSet(BeanCollectionLoader loader, EntityBean ownerBean, String propertyName)
public void reset(EntityBean ownerBean, String propertyName)
BeanCollection
This is done as part of bean refresh.
reset
in interface BeanCollection<E>
public boolean isSkipSave()
BeanCollection
Returning true means can safely skip cascade save for this bean collection.
isSkipSave
in interface BeanCollection<E>
public void addEntityBean(EntityBean bean)
BeanCollectionAdd
addEntityBean
in interface BeanCollectionAdd
public void loadFrom(BeanCollection<?> other)
BeanCollection
loadFrom
in interface BeanCollection<E>
public void internalAddWithCheck(Object bean)
BeanCollection
internalAddWithCheck
in interface BeanCollection<E>
public void internalAdd(Object bean)
BeanCollection
This is disallowed for BeanMap.
internalAdd
in interface BeanCollection<E>
public boolean isPopulated()
isPopulated
in interface BeanCollection<E>
public boolean isReference()
isReference
in interface BeanCollection<E>
public boolean checkEmptyLazyLoad()
BeanCollection
That is, if the collection was not loaded due to filterMany predicates etc then make sure the collection is set to empty.
checkEmptyLazyLoad
in interface BeanCollection<E>
public void setActualSet(Set<?> set)
public Set<E> getActualSet()
public Collection<E> getActualDetails()
BeanCollection
getActualDetails
in interface BeanCollection<E>
public Collection<?> getActualEntries()
BeanCollection
For maps this returns the entrySet as we need the keys of the map.
getActualEntries
in interface BeanCollection<E>
public int hashCode()
public void addBean(E bean)
BeanCollection
addBean
in interface BeanCollection<E>
public void removeBean(E bean)
BeanCollection
removeBean
in interface BeanCollection<E>
public boolean addAll(Collection<? extends E> addCollection)
public void clear()
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<E>
containsAll
in interface Set<E>
public boolean isEmpty()
BeanCollection
isEmpty
in interface BeanCollection<E>
isEmpty
in interface Collection<E>
isEmpty
in interface Set<E>
public boolean removeAll(Collection<?> beans)
public boolean retainAll(Collection<?> beans)
public int size()
BeanCollection
size
in interface BeanCollection<E>
size
in interface Collection<E>
size
in interface Set<E>
public <T> T[] toArray(T[] a)
public BeanCollection<E> getShallowCopy()
BeanCollection
getShallowCopy
in interface BeanCollection<E>
public EntityBean getOwnerBean()
BeanCollection
getOwnerBean
in interface BeanCollection<E>
public String getPropertyName()
BeanCollection
getPropertyName
in interface BeanCollection<E>
public ExpressionList<?> getFilterMany()
BeanCollection
This is so that the filter can be applied on refresh.
getFilterMany
in interface BeanCollection<E>
public void setFilterMany(ExpressionList<?> filterMany)
BeanCollection
setFilterMany
in interface BeanCollection<E>
public void setDisableLazyLoad(boolean disableLazyLoad)
BeanCollection
setDisableLazyLoad
in interface BeanCollection<E>
public boolean isRegisteredWithLoadContext()
BeanCollection
isRegisteredWithLoadContext
in interface BeanCollection<E>
public void setLoader(BeanCollectionLoader loader)
BeanCollection
This is effectively the batch loading context this collection is registered with.
setLoader
in interface BeanCollection<E>
public boolean isReadOnly()
BeanCollection
isReadOnly
in interface BeanCollection<E>
public void setReadOnly(boolean readOnly)
BeanCollection
setReadOnly
in interface BeanCollection<E>
public BeanCollection.ModifyListenMode getModifyListening()
BeanCollection
getModifyListening
in interface BeanCollection<E>
public void setModifyListening(BeanCollection.ModifyListenMode mode)
setModifyListening
in interface BeanCollection<E>
public BeanCollection.ModifyListenMode getModifyListenMode()
public void modifyAddition(E bean)
BeanCollection
This will potentially end up as an insert into a intersection table for a ManyToMany.
modifyAddition
in interface BeanCollection<E>
public void modifyRemoval(Object bean)
BeanCollection
This will potentially end up as an delete from an intersection table for a ManyToMany.
modifyRemoval
in interface BeanCollection<E>
public void modifyReset()
BeanCollection
modifyReset
in interface BeanCollection<E>
public Set<E> getModifyAdditions()
BeanCollection
getModifyAdditions
in interface BeanCollection<E>
public Set<E> getModifyRemovals()
BeanCollection
getModifyRemovals
in interface BeanCollection<E>
public boolean holdsModifications()
holdsModifications
in interface BeanCollection<E>
public boolean wasTouched()
BeanCollection
wasTouched
in interface BeanCollection<E>
Copyright © 2019. All rights reserved.