public interface BeanCollection<E> extends Serializable
This also includes the ability to listen for additions and removals to or from the Map Set or List. The purpose of gathering the additions and removals is to support persisting ManyToMany objects. The additions and removals become inserts and deletes from the intersection table.
Technically this is NOT an extension of java.util.Collection. The reason being that java.util.Map is not a Collection. I realise this makes this name confusing so I apologise for that.
Modifier and Type | Interface and Description |
---|---|
static class |
BeanCollection.ModifyListenMode |
Modifier and Type | Method and Description |
---|---|
void |
addBean(E bean)
Add a bean to the list/set with modifyListen notification.
|
boolean |
checkEmptyLazyLoad()
Check after the lazy load that the underlying collection is not null
(handle case where join to many not outer).
|
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.
|
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.
|
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.
|
boolean |
holdsModifications()
Return true if the collection holds modifications.
|
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()
return true if there are real rows held.
|
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.
|
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.
|
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.
|
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 beanLoader)
Set the loader that will be used to lazy/query load this collection.
|
void |
setModifyListening(BeanCollection.ModifyListenMode modifyListenMode)
Set modify listening 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.
|
boolean |
wasTouched()
Has been modified by an addition or removal.
|
void setDisableLazyLoad(boolean disableLazyLoad)
void loadFrom(BeanCollection<?> other)
void removeBean(E bean)
void reset(EntityBean ownerBean, String propertyName)
This is done as part of bean refresh.
boolean isSkipSave()
Returning true means can safely skip cascade save for this bean collection.
boolean holdsModifications()
EntityBean getOwnerBean()
String getPropertyName()
boolean checkEmptyLazyLoad()
That is, if the collection was not loaded due to filterMany predicates etc then make sure the collection is set to empty.
ExpressionList<?> getFilterMany()
This is so that the filter can be applied on refresh.
void setFilterMany(ExpressionList<?> filterMany)
boolean isRegisteredWithLoadContext()
void setLoader(BeanCollectionLoader beanLoader)
This is effectively the batch loading context this collection is registered with.
void setReadOnly(boolean readOnly)
boolean isReadOnly()
void internalAdd(Object bean)
This is disallowed for BeanMap.
void internalAddWithCheck(Object bean)
int size()
boolean isEmpty()
Collection<E> getActualDetails()
Collection<?> getActualEntries()
For maps this returns the entrySet as we need the keys of the map.
boolean isPopulated()
boolean isReference()
void setModifyListening(BeanCollection.ModifyListenMode modifyListenMode)
This is required only for ManyToMany collections. The additions and deletions are used to insert or delete entries from the intersection table. Otherwise modifyListening is false.
BeanCollection.ModifyListenMode getModifyListening()
void modifyAddition(E bean)
This will potentially end up as an insert into a intersection table for a ManyToMany.
void modifyRemoval(Object bean)
This will potentially end up as an delete from an intersection table for a ManyToMany.
Set<E> getModifyAdditions()
Set<E> getModifyRemovals()
void modifyReset()
boolean wasTouched()
BeanCollection<E> getShallowCopy()
Copyright © 2019. All rights reserved.