|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.cayenne.access.IncrementalFaultList
public class IncrementalFaultList
A synchronized list that serves as a container of DataObjects. It is returned when a paged query is performed by DataContext. On creation, only the first "page" is fully resolved, for the rest of the objects only their ObjectIds are read. Pages following the first page are resolved on demand only. On access to an element, the list would ensure that this element as well as all its siblings on the same page are fully resolved.
The list can hold DataRows or DataObjects. Attempts to add any other object types will result in an exception.
Performance note: certain operations like toArray would trigger full
list fetch.
| Field Summary | |
|---|---|
protected DataContext |
dataContext
|
protected java.util.List |
elements
|
protected SelectQuery |
internalQuery
|
protected int |
maxFetchSize
Defines the upper limit on the size of fetches. |
protected int |
pageSize
|
protected ObjEntity |
rootEntity
|
protected int |
rowWidth
Stores a hint allowing to distinguish data rows from unfetched ids when the query fetches data rows. |
protected int |
unfetchedObjects
|
| Constructor Summary | |
|---|---|
IncrementalFaultList(DataContext dataContext,
Query query)
Creates a new IncrementalFaultList using a given DataContext and query. |
|
IncrementalFaultList(IncrementalFaultList list)
Creates a new list copying settings from another list. |
|
| Method Summary | |
|---|---|
void |
add(int index,
java.lang.Object element)
|
boolean |
add(java.lang.Object o)
|
boolean |
addAll(java.util.Collection c)
|
boolean |
addAll(int index,
java.util.Collection c)
|
void |
clear()
|
boolean |
contains(java.lang.Object o)
|
boolean |
containsAll(java.util.Collection c)
|
protected void |
fillIn(Query query)
Performs initialization of the internal list of objects. |
java.lang.Object |
get(int index)
|
DataContext |
getDataContext()
Returns the dataContext. |
int |
getMaxFetchSize()
Get the upper bound on the number of records to resolve in one round trip to the database. |
int |
getPageSize()
Returns the pageSize. |
int |
getUnfetchedObjects()
Returns a total number of objects that are not resolved yet. |
int |
indexOf(java.lang.Object o)
|
boolean |
isEmpty()
|
java.util.Iterator |
iterator()
Return an iterator for this list. |
int |
lastIndexOf(java.lang.Object o)
|
java.util.ListIterator |
listIterator()
Returns a list iterator for this list. |
java.util.ListIterator |
listIterator(int index)
Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list. |
int |
pageIndex(int elementIndex)
Returns zero-based index of the virtual "page" for a given array element index. |
java.lang.Object |
remove(int index)
|
boolean |
remove(java.lang.Object o)
|
boolean |
removeAll(java.util.Collection c)
|
void |
resolveAll()
Will resolve all unread objects. |
protected void |
resolveInterval(int fromIndex,
int toIndex)
Resolves a sublist of objects starting at fromIndex up to but not
including toIndex. |
boolean |
retainAll(java.util.Collection c)
|
java.lang.Object |
set(int index,
java.lang.Object element)
|
void |
setMaxFetchSize(int fetchSize)
|
int |
size()
|
java.util.List |
subList(int fromIndex,
int toIndex)
|
java.lang.Object[] |
toArray()
|
java.lang.Object[] |
toArray(java.lang.Object[] a)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.List |
|---|
equals, hashCode |
| Field Detail |
|---|
protected int pageSize
protected java.util.List elements
protected DataContext dataContext
protected ObjEntity rootEntity
protected SelectQuery internalQuery
protected int unfetchedObjects
protected int rowWidth
protected int maxFetchSize
| Constructor Detail |
|---|
public IncrementalFaultList(IncrementalFaultList list)
public IncrementalFaultList(DataContext dataContext,
Query query)
dataContext - DataContext used by IncrementalFaultList to fill itself with
objects.query - Main query used to retrieve data. Must have "pageSize" property set to
a value greater than zero.| Method Detail |
|---|
protected void fillIn(Query query)
public void resolveAll()
protected void resolveInterval(int fromIndex,
int toIndex)
fromIndex up to but not
including toIndex. Internally performs bound checking and trims
indexes accordingly.
public int pageIndex(int elementIndex)
public int getMaxFetchSize()
public void setMaxFetchSize(int fetchSize)
public DataContext getDataContext()
public int getPageSize()
public java.util.ListIterator listIterator()
listIterator in interface java.util.Listpublic java.util.ListIterator listIterator(int index)
listIterator in interface java.util.Listpublic java.util.Iterator iterator()
iterator in interface java.lang.Iterableiterator in interface java.util.Collectioniterator in interface java.util.List
public void add(int index,
java.lang.Object element)
add in interface java.util.ListList.add(int, Object)public boolean add(java.lang.Object o)
add in interface java.util.Collectionadd in interface java.util.ListCollection.add(Object)public boolean addAll(java.util.Collection c)
addAll in interface java.util.CollectionaddAll in interface java.util.ListCollection.addAll(Collection)
public boolean addAll(int index,
java.util.Collection c)
addAll in interface java.util.ListList.addAll(int, Collection)public void clear()
clear in interface java.util.Collectionclear in interface java.util.ListCollection.clear()public boolean contains(java.lang.Object o)
contains in interface java.util.Collectioncontains in interface java.util.ListCollection.contains(Object)public boolean containsAll(java.util.Collection c)
containsAll in interface java.util.CollectioncontainsAll in interface java.util.ListCollection.containsAll(Collection)public java.lang.Object get(int index)
get in interface java.util.ListList.get(int)public int indexOf(java.lang.Object o)
indexOf in interface java.util.ListList.indexOf(Object)public boolean isEmpty()
isEmpty in interface java.util.CollectionisEmpty in interface java.util.ListCollection.isEmpty()public int lastIndexOf(java.lang.Object o)
lastIndexOf in interface java.util.ListList.lastIndexOf(Object)public java.lang.Object remove(int index)
remove in interface java.util.ListList.remove(int)public boolean remove(java.lang.Object o)
remove in interface java.util.Collectionremove in interface java.util.ListCollection.remove(Object)public boolean removeAll(java.util.Collection c)
removeAll in interface java.util.CollectionremoveAll in interface java.util.ListCollection.removeAll(Collection)public boolean retainAll(java.util.Collection c)
retainAll in interface java.util.CollectionretainAll in interface java.util.ListCollection.retainAll(Collection)
public java.lang.Object set(int index,
java.lang.Object element)
set in interface java.util.ListList.set(int, Object)public int size()
size in interface java.util.Collectionsize in interface java.util.ListCollection.size()
public java.util.List subList(int fromIndex,
int toIndex)
subList in interface java.util.Listpublic java.lang.Object[] toArray()
toArray in interface java.util.CollectiontoArray in interface java.util.Listpublic java.lang.Object[] toArray(java.lang.Object[] a)
toArray in interface java.util.CollectiontoArray in interface java.util.ListCollection.toArray(Object[])public int getUnfetchedObjects()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||