|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface BeanCollection<E>
Lazy loading capable Maps, Lists and Sets.
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 | |
---|---|
static class |
BeanCollection.ModifyListenMode
|
Field Summary | |
---|---|
static int |
DEFAULT
The default state (CacheStrategy readOnly can be applied). |
static int |
READONLY
Bean is READ ONLY (not editable). |
static int |
SHARED
Read Only immutable state and can't be made editable (in cache and sharable). |
Method Summary | |
---|---|
void |
backgroundFetchWait()
Wait for the fetch to complete. |
void |
backgroundFetchWait(long wait,
TimeUnit timeUnit)
Wait for the fetch to complete with a given timeout. |
boolean |
checkEmptyLazyLoad()
Check after the lazy load that the underlying collection is not null (handle case where join to many not outer). |
Object |
getActualCollection()
Returns the underlying List Set or Map object. |
Collection<E> |
getActualDetails()
Returns the underlying details as an iterator. |
ExpressionList<?> |
getFilterMany()
Return the filter (if any) that was used in building this collection. |
int |
getLoaderIndex()
Return the index position of this collection in the lazy/query loader. |
Set<E> |
getModifyAdditions()
Return the list of objects added to the list set or map. |
Set<E> |
getModifyRemovals()
Return the list of objects removed from the list set or map. |
Object |
getOwnerBean()
Return the bean that owns this collection. |
String |
getPropertyName()
Return the bean property name this collection represents. |
boolean |
hasMoreRows()
Set to true if maxRows was hit and there are actually more rows available. |
void |
internalAdd(Object bean)
Add the bean to the collection. |
boolean |
isEmpty()
Return true if the List Set or Map is empty. |
boolean |
isFinishedFetch()
Returns true if the fetch has finished. |
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 |
isSharedInstance()
Return true if this collection is owned by a sharedInstance. |
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 |
setBackgroundFetch(Future<Integer> future)
Set when this collection is being loaded via a background thread. |
void |
setBeanCollectionTouched(BeanCollectionTouched notify)
Set a listener to be notified when the BeanCollection is first touched. |
void |
setFilterMany(ExpressionList<?> filterMany)
Set the filter that was used in building this collection. |
void |
setFinishedFetch(boolean finishedFetch)
Set to true when a fetch has finished. |
void |
setHasMoreRows(boolean hasMoreRows)
Set to true when maxRows is hit but there are actually more rows available. |
void |
setLoader(int beanLoaderIndex,
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. |
void |
setSharedInstance()
Set when this collection is owned by a sharedInstance. |
int |
size()
Return the number of elements in the List Set or Map. |
Field Detail |
---|
static final int DEFAULT
static final int READONLY
static final int SHARED
Method Detail |
---|
Object getOwnerBean()
String getPropertyName()
int getLoaderIndex()
Used for batch loading of collections.
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)
void setBackgroundFetch(Future<Integer> future)
Refer to Query.setBackgroundFetchAfter(int)
void backgroundFetchWait(long wait, TimeUnit timeUnit)
Refer to Query.setBackgroundFetchAfter(int)
void backgroundFetchWait()
Refer to Query.setBackgroundFetchAfter(int)
boolean isSharedInstance()
That is, return true if it is a Many property of a bean in the cache.
void setSharedInstance()
That is, it is a Many property on a bean in the cache.
void setBeanCollectionTouched(BeanCollectionTouched notify)
void setLoader(int beanLoaderIndex, BeanCollectionLoader beanLoader)
void setReadOnly(boolean readOnly)
boolean isReadOnly()
void internalAdd(Object bean)
This is disallowed for BeanMap.
Object getActualCollection()
int size()
boolean isEmpty()
Collection<E> getActualDetails()
Note that for maps this returns the entrySet as we need the keys of the map.
boolean hasMoreRows()
Can be used by client code that is paging through results using setFirstRow() setMaxRows(). If this returns true then the client can display a 'next' button etc.
void setHasMoreRows(boolean hasMoreRows)
boolean isFinishedFetch()
void setFinishedFetch(boolean finishedFetch)
boolean isPopulated()
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.
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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |