public class IncrementalFaultList<E> extends Object implements List<E>, Serializable
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.
Modifier and Type | Field and Description |
---|---|
protected DataContext |
dataContext |
protected 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 and Description |
---|
IncrementalFaultList(DataContext dataContext,
Query query,
int maxFetchSize)
Creates a new IncrementalFaultList using a given DataContext and query.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
Object element) |
boolean |
add(Object o) |
boolean |
addAll(Collection<? extends E> c) |
boolean |
addAll(int index,
Collection<? extends E> c) |
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
protected void |
fillIn(Query query,
List<Object> 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(Object o) |
boolean |
isEmpty() |
Iterator<E> |
iterator()
Return an iterator for this list.
|
int |
lastIndexOf(Object o) |
ListIterator<E> |
listIterator()
Returns a list iterator for this list.
|
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(Object o) |
boolean |
removeAll(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(Collection<?> c) |
E |
set(int index,
Object element) |
void |
setMaxFetchSize(int fetchSize) |
int |
size() |
List<E> |
subList(int fromIndex,
int toIndex) |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals, hashCode, replaceAll, sort, spliterator
parallelStream, removeIf, stream
protected int pageSize
protected final List elements
protected DataContext dataContext
protected ObjEntity rootEntity
protected SelectQuery<?> internalQuery
protected int unfetchedObjects
protected int idWidth
protected int maxFetchSize
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 queryprotected void fillIn(Query query, List<Object> 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 ListIterator<E> listIterator()
listIterator
in interface List<E>
public ListIterator<E> listIterator(int index)
listIterator
in interface List<E>
public Iterator<E> iterator()
public void add(int index, Object element)
add
in interface List<E>
List.add(int, Object)
public boolean add(Object o)
add
in interface Collection<E>
add
in interface List<E>
Collection.add(Object)
public boolean addAll(Collection<? extends E> c)
addAll
in interface Collection<E>
addAll
in interface List<E>
Collection.addAll(Collection)
public boolean addAll(int index, Collection<? extends E> c)
addAll
in interface List<E>
List.addAll(int, Collection)
public void clear()
clear
in interface Collection<E>
clear
in interface List<E>
Collection.clear()
public boolean contains(Object o)
contains
in interface Collection<E>
contains
in interface List<E>
Collection.contains(Object)
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<E>
containsAll
in interface List<E>
Collection.containsAll(Collection)
public int indexOf(Object o)
indexOf
in interface List<E>
List.indexOf(Object)
public boolean isEmpty()
isEmpty
in interface Collection<E>
isEmpty
in interface List<E>
Collection.isEmpty()
public int lastIndexOf(Object o)
lastIndexOf
in interface List<E>
public boolean remove(Object o)
public boolean removeAll(Collection<?> c)
public boolean retainAll(Collection<?> c)
public E set(int index, Object element)
set
in interface List<E>
List.set(int, Object)
public int size()
size
in interface Collection<E>
size
in interface List<E>
Collection.size()
public Object[] toArray()
public <T> T[] toArray(T[] a)
public int getUnfetchedObjects()
Copyright © 2001–2017 Apache Cayenne. All rights reserved.