- All Superinterfaces:
Serializable,ToStringAware
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.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a bean to the list/set with modifyListen notification.booleanCheck after the lazy load that the underlying collection is not null (handle case where join to many not outer).Returns the underlying collection of beans from the Set, Map or List.Collection<?>Returns the underlying entries so for Maps this is a collection of Map.Entry.Return the filter (if any) that was used in building this collection.Return the list of objects added to the list set or map.Return the current modify listening mode.Return the list of objects removed from the list set or map.Return the bean that owns this collection.Return the bean property name this collection represents.Return a shallow copy of this collection that is modifiable.booleanReturn true if the collection is modify listening and has modifications.booleanReturn true if the collection holds modifications.voidinternalAdd(Object bean) Add the bean to the collection.voidinternalAddWithCheck(Object bean) Add the bean with a check to see if it is already contained.booleanisEmpty()Return true if the List Set or Map is empty.booleanreturn true if there are real rows held.booleanReturn true if the collection should be treated as readOnly and no elements can be added or removed etc.booleanReturn true if this is a reference (lazy loading) bean collection.booleanReturn true if the collection has been registered with the batch loading context.booleanReturn true if the collection is uninitialised or is empty without any held modifications.voidloadFrom(BeanCollection<?> other) Load bean from another collection.voidmodifyAddition(E bean) Add an object to the additions list.voidmodifyRemoval(Object bean) Add an object to the deletions list.voidReset the set of additions and deletions.voidremoveBean(E bean) Remove a bean to the list/set with modifyListen notification.voidreset(EntityBean ownerBean, String propertyName) Reset the collection back to an empty state ready for reloading.voidsetDisableLazyLoad(boolean disableLazyLoad) Set the disableLazyLoad state.voidsetFilterMany(ExpressionList<?> filterMany) Set the filter that was used in building this collection.voidsetLoader(BeanCollectionLoader beanLoader) Set the loader that will be used to lazy/query load this collection.voidsetModifyListening(BeanCollection.ModifyListenMode modifyListenMode) Set modify listening on or off.voidsetReadOnly(boolean readOnly) Set to true if you want the BeanCollection to be treated as read only.intsize()Return the number of elements in the List Set or Map.booleanHas been modified by an addition or removal.Methods inherited from interface io.ebean.bean.ToStringAware
toString
-
Method Details
-
setDisableLazyLoad
void setDisableLazyLoad(boolean disableLazyLoad) Set the disableLazyLoad state. -
loadFrom
Load bean from another collection. -
addBean
Add a bean to the list/set with modifyListen notification. -
removeBean
Remove a bean to the list/set with modifyListen notification. -
reset
Reset the collection back to an empty state ready for reloading.This is done as part of bean refresh.
-
isSkipSave
boolean isSkipSave()Return true if the collection is uninitialised or is empty without any held modifications.Returning true means can safely skip cascade save for this bean collection.
-
holdsModifications
boolean holdsModifications()Return true if the collection holds modifications. -
getOwnerBean
EntityBean getOwnerBean()Return the bean that owns this collection. -
getPropertyName
String getPropertyName()Return the bean property name this collection represents. -
checkEmptyLazyLoad
boolean checkEmptyLazyLoad()Check after the lazy load that the underlying collection is not null (handle case where join to many not outer).That is, if the collection was not loaded due to filterMany predicates etc then make sure the collection is set to empty.
-
getFilterMany
ExpressionList<?> getFilterMany()Return the filter (if any) that was used in building this collection.This is so that the filter can be applied on refresh.
-
setFilterMany
Set the filter that was used in building this collection. -
isRegisteredWithLoadContext
boolean isRegisteredWithLoadContext()Return true if the collection has been registered with the batch loading context. -
setLoader
Set the loader that will be used to lazy/query load this collection.This is effectively the batch loading context this collection is registered with.
-
setReadOnly
void setReadOnly(boolean readOnly) Set to true if you want the BeanCollection to be treated as read only. This means no elements can be added or removed etc. -
isReadOnly
boolean isReadOnly()Return true if the collection should be treated as readOnly and no elements can be added or removed etc. -
internalAdd
Add the bean to the collection. This is disallowed for BeanMap. -
internalAddWithCheck
Add the bean with a check to see if it is already contained. -
size
int size()Return the number of elements in the List Set or Map. -
isEmpty
boolean isEmpty()Return true if the List Set or Map is empty. -
getActualDetails
Collection<E> getActualDetails()Returns the underlying collection of beans from the Set, Map or List. -
getActualEntries
Collection<?> getActualEntries()Returns the underlying entries so for Maps this is a collection of Map.Entry.For maps this returns the entrySet as we need the keys of the map.
-
isPopulated
boolean isPopulated()return true if there are real rows held. Return false is this is using Deferred fetch to lazy load the rows and the rows have not yet been fetched. -
isReference
boolean isReference()Return true if this is a reference (lazy loading) bean collection. This is the same as !isPopulated(); -
hasModifications
boolean hasModifications()Return true if the collection is modify listening and has modifications. -
setModifyListening
Set modify listening on or off. This is used to keep track of objects that have been added to or removed from the list set or map.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.
-
getModifyListening
BeanCollection.ModifyListenMode getModifyListening()Return the current modify listening mode. Can be null for on newly created beans. -
modifyAddition
Add an object to the additions list.This will potentially end up as an insert into a intersection table for a ManyToMany.
-
modifyRemoval
Add an object to the deletions list.This will potentially end up as an delete from an intersection table for a ManyToMany.
-
getModifyAdditions
Return the list of objects added to the list set or map. These will used to insert rows into the intersection table of a ManyToMany. -
getModifyRemovals
Return the list of objects removed from the list set or map. These will used to delete rows from the intersection table of a ManyToMany. -
modifyReset
void modifyReset()Reset the set of additions and deletions. This is called after the additions and removals have been processed. -
wasTouched
boolean wasTouched()Has been modified by an addition or removal. -
getShallowCopy
BeanCollection<E> getShallowCopy()Return a shallow copy of this collection that is modifiable.
-