|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.cayenne.access.IncrementalFaultList<E>
public class IncrementalFaultList<E>
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 int |
idWidth
Stores a hint allowing to distinguish data rows from unfetched ids when the query fetches data rows. |
protected SelectQuery |
internalQuery
|
protected int |
maxFetchSize
Defines the upper limit on the size of fetches. |
protected int |
pageSize
|
protected ObjEntity |
rootEntity
|
protected int |
unfetchedObjects
|
| Constructor Summary | |
|---|---|
IncrementalFaultList(DataContext dataContext,
Query query)
Deprecated. since 3.1 use IncrementalFaultList(DataContext, Query, int). |
|
IncrementalFaultList(DataContext dataContext,
Query query,
int maxFetchSize)
Creates a new IncrementalFaultList using a given DataContext and query. |
|
| Method Summary | ||
|---|---|---|
void |
add(int index,
java.lang.Object element)
|
|
boolean |
add(java.lang.Object o)
|
|
boolean |
addAll(java.util.Collection<? extends E> c)
|
|
boolean |
addAll(int index,
java.util.Collection<? extends E> c)
|
|
void |
clear()
|
|
boolean |
contains(java.lang.Object o)
|
|
boolean |
containsAll(java.util.Collection<?> c)
|
|
protected void |
fillIn(Query query,
java.util.List elementsList)
Performs initialization of the list of objects. |
|
E |
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<E> |
iterator()
Return an iterator for this list. |
|
int |
lastIndexOf(java.lang.Object o)
|
|
java.util.ListIterator<E> |
listIterator()
Returns a list iterator for this list. |
|
java.util.ListIterator<E> |
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. |
|
E |
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)
|
|
E |
set(int index,
java.lang.Object element)
|
|
void |
setMaxFetchSize(int fetchSize)
|
|
int |
size()
|
|
java.util.List<E> |
subList(int fromIndex,
int toIndex)
|
|
java.lang.Object[] |
toArray()
|
|
|
toArray(T[] 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 idWidth
protected int maxFetchSize
| Constructor Detail |
|---|
public IncrementalFaultList(DataContext dataContext,
Query query)
IncrementalFaultList(DataContext, Query, int).
public IncrementalFaultList(DataContext dataContext,
Query query,
int maxFetchSize)
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.maxFetchSize - maximum number of fetches in one query| Method Detail |
|---|
protected void fillIn(Query query,
java.util.List elementsList)
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<E> listIterator()
listIterator in interface java.util.List<E>public java.util.ListIterator<E> listIterator(int index)
listIterator in interface java.util.List<E>public java.util.Iterator<E> iterator()
iterator in interface java.lang.Iterable<E>iterator in interface java.util.Collection<E>iterator in interface java.util.List<E>
public void add(int index,
java.lang.Object element)
add in interface java.util.List<E>List.add(int, Object)public boolean add(java.lang.Object o)
add in interface java.util.Collection<E>add in interface java.util.List<E>Collection.add(Object)public boolean addAll(java.util.Collection<? extends E> c)
addAll in interface java.util.Collection<E>addAll in interface java.util.List<E>Collection.addAll(Collection)
public boolean addAll(int index,
java.util.Collection<? extends E> c)
addAll in interface java.util.List<E>List.addAll(int, Collection)public void clear()
clear in interface java.util.Collection<E>clear in interface java.util.List<E>Collection.clear()public boolean contains(java.lang.Object o)
contains in interface java.util.Collection<E>contains in interface java.util.List<E>Collection.contains(Object)public boolean containsAll(java.util.Collection<?> c)
containsAll in interface java.util.Collection<E>containsAll in interface java.util.List<E>Collection.containsAll(Collection)public E get(int index)
get in interface java.util.List<E>public int indexOf(java.lang.Object o)
indexOf in interface java.util.List<E>List.indexOf(Object)public boolean isEmpty()
isEmpty in interface java.util.Collection<E>isEmpty in interface java.util.List<E>Collection.isEmpty()public int lastIndexOf(java.lang.Object o)
lastIndexOf in interface java.util.List<E>public E remove(int index)
remove in interface java.util.List<E>public boolean remove(java.lang.Object o)
remove in interface java.util.Collection<E>remove in interface java.util.List<E>public boolean removeAll(java.util.Collection<?> c)
removeAll in interface java.util.Collection<E>removeAll in interface java.util.List<E>public boolean retainAll(java.util.Collection<?> c)
retainAll in interface java.util.Collection<E>retainAll in interface java.util.List<E>
public E set(int index,
java.lang.Object element)
set in interface java.util.List<E>List.set(int, Object)public int size()
size in interface java.util.Collection<E>size in interface java.util.List<E>Collection.size()
public java.util.List<E> subList(int fromIndex,
int toIndex)
subList in interface java.util.List<E>public java.lang.Object[] toArray()
toArray in interface java.util.Collection<E>toArray in interface java.util.List<E>public <T> T[] toArray(T[] a)
toArray in interface java.util.Collection<E>toArray in interface java.util.List<E>public int getUnfetchedObjects()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||