|
|||||||||
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.List
public java.util.ListIterator listIterator(int index)
listIterator
in interface java.util.List
public java.util.Iterator iterator()
iterator
in interface java.lang.Iterable
iterator
in interface java.util.Collection
iterator
in interface java.util.List
public void add(int index, java.lang.Object element)
add
in interface java.util.List
List.add(int, Object)
public boolean add(java.lang.Object o)
add
in interface java.util.Collection
add
in interface java.util.List
Collection.add(Object)
public boolean addAll(java.util.Collection c)
addAll
in interface java.util.Collection
addAll
in interface java.util.List
Collection.addAll(Collection)
public boolean addAll(int index, java.util.Collection c)
addAll
in interface java.util.List
List.addAll(int, Collection)
public void clear()
clear
in interface java.util.Collection
clear
in interface java.util.List
Collection.clear()
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection
contains
in interface java.util.List
Collection.contains(Object)
public boolean containsAll(java.util.Collection c)
containsAll
in interface java.util.Collection
containsAll
in interface java.util.List
Collection.containsAll(Collection)
public java.lang.Object get(int index)
get
in interface java.util.List
List.get(int)
public int indexOf(java.lang.Object o)
indexOf
in interface java.util.List
List.indexOf(Object)
public boolean isEmpty()
isEmpty
in interface java.util.Collection
isEmpty
in interface java.util.List
Collection.isEmpty()
public int lastIndexOf(java.lang.Object o)
lastIndexOf
in interface java.util.List
List.lastIndexOf(Object)
public java.lang.Object remove(int index)
remove
in interface java.util.List
List.remove(int)
public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection
remove
in interface java.util.List
Collection.remove(Object)
public boolean removeAll(java.util.Collection c)
removeAll
in interface java.util.Collection
removeAll
in interface java.util.List
Collection.removeAll(Collection)
public boolean retainAll(java.util.Collection c)
retainAll
in interface java.util.Collection
retainAll
in interface java.util.List
Collection.retainAll(Collection)
public java.lang.Object set(int index, java.lang.Object element)
set
in interface java.util.List
List.set(int, Object)
public int size()
size
in interface java.util.Collection
size
in interface java.util.List
Collection.size()
public java.util.List subList(int fromIndex, int toIndex)
subList
in interface java.util.List
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection
toArray
in interface java.util.List
public java.lang.Object[] toArray(java.lang.Object[] a)
toArray
in interface java.util.Collection
toArray
in interface java.util.List
Collection.toArray(Object[])
public int getUnfetchedObjects()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |