|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.equanda.persistence.LazyList<ID,TYPE>
public abstract class LazyList<ID,TYPE extends HasId<ID>>
Abstract base class for LazyList instances.
A LazyList tries to get the resultset in batches if possible. The batch size if configurable. These batches are cached and the expiration timeout for this cache is also configurable. When an element is obtained, an attempt is made to get the data from the cache. If the cache is stale (timeout exceeded), then the instance is refreshed (to minimize the number of full selectors). For resultsets which cannot be batched (ADD on subselects), the full list of UOIDs for the elements is maintained. Depending on some conditions, it is possible that the size() method does not function. In that case it will throw an exception. isEmpty should always function. The behaviour is optimized for (forward) iteration of the list.
Field Summary | |
---|---|
protected EquandaQuery |
query
|
protected SelectorsStateType |
selectorsState
|
Constructor Summary | |
---|---|
LazyList(EquandaQuery query)
|
|
LazyList(List<EquandaQuery> queries,
boolean addOperator,
int equandaLimit)
|
Method Summary | ||
---|---|---|
void |
add(int i,
TYPE type)
|
|
boolean |
add(TYPE type)
|
|
boolean |
addAll(Collection<? extends TYPE> types)
|
|
boolean |
addAll(int i,
Collection<? extends TYPE> types)
|
|
void |
clear()
|
|
boolean |
contains(Object obj)
|
|
boolean |
containsAll(Collection<?> objects)
|
|
long |
fullSize()
|
|
TYPE |
get(int index)
|
|
protected abstract int |
getCacheCapacity()
Get the max number of objecs to keep in cache |
|
protected abstract int |
getCacheExpirationPeriod()
Get the number of milliseconds that the cache is considered valid |
|
protected abstract TYPE[] |
getMultipleObjects(ID[] ids)
Get TYPE objects for the given ids |
|
protected abstract TYPE[] |
getMultipleObjects(int first,
int size)
|
|
protected abstract TYPE |
getOneObject(ID id)
Get TYPE object for the given Uoid. |
|
protected abstract TYPE |
getOneObject(int index)
|
|
protected abstract EquandaSelector |
getSelector()
Get the selector object for the TYPE |
|
int |
indexOf(Object o)
|
|
boolean |
isEmpty()
make List object complete |
|
Iterator<TYPE> |
iterator()
|
|
int |
lastIndexOf(Object o)
|
|
ListIterator<TYPE> |
listIterator()
|
|
ListIterator<TYPE> |
listIterator(int i)
|
|
void |
refresh()
refresh list, force release cache |
|
protected abstract TYPE |
refreshObject(TYPE obj)
Refresh the given object to make sure the data is live (used when cache timeout expired) |
|
TYPE |
remove(int index)
|
|
boolean |
remove(Object o)
|
|
boolean |
removeAll(Collection<?> objects)
|
|
boolean |
retainAll(Collection<?> objects)
|
|
TYPE |
set(int i,
TYPE type)
|
|
void |
setMockObject(MockObject m)
|
|
int |
size()
Deprecated. |
|
List<TYPE> |
subList(int i,
int i1)
|
|
Object[] |
toArray()
|
|
|
toArray(T[] ts)
|
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 EquandaQuery query
protected SelectorsStateType selectorsState
Constructor Detail |
---|
public LazyList(EquandaQuery query)
public LazyList(List<EquandaQuery> queries, boolean addOperator, int equandaLimit)
Method Detail |
---|
protected abstract int getCacheCapacity()
protected abstract int getCacheExpirationPeriod()
protected abstract EquandaSelector getSelector() throws NamingException
NamingException
- problemsprotected abstract TYPE getOneObject(ID id) throws NamingException, EquandaException
id
- pk
NamingException
- problems
EquandaException
- problemsprotected abstract TYPE[] getMultipleObjects(ID[] ids) throws NamingException, EquandaException
ids
- pks
NamingException
- problems
EquandaException
- problemsprotected abstract TYPE refreshObject(TYPE obj) throws NamingException, EquandaException
obj
- object to refresh
NamingException
- problems
EquandaException
- problemsprotected abstract TYPE getOneObject(int index) throws NamingException, EquandaException
NamingException
EquandaException
protected abstract TYPE[] getMultipleObjects(int first, int size) throws NamingException, EquandaException
NamingException
EquandaException
public void setMockObject(MockObject m)
public boolean contains(Object obj)
contains
in interface Collection<TYPE extends HasId<ID>>
contains
in interface List<TYPE extends HasId<ID>>
public TYPE get(int index)
get
in interface List<TYPE extends HasId<ID>>
public Iterator<TYPE> iterator()
iterator
in interface Iterable<TYPE extends HasId<ID>>
iterator
in interface Collection<TYPE extends HasId<ID>>
iterator
in interface List<TYPE extends HasId<ID>>
public long fullSize()
public int size()
size
in interface Collection<TYPE extends HasId<ID>>
size
in interface List<TYPE extends HasId<ID>>
public boolean isEmpty()
isEmpty
in interface Collection<TYPE extends HasId<ID>>
isEmpty
in interface List<TYPE extends HasId<ID>>
public boolean add(TYPE type)
add
in interface Collection<TYPE extends HasId<ID>>
add
in interface List<TYPE extends HasId<ID>>
public void add(int i, TYPE type)
add
in interface List<TYPE extends HasId<ID>>
public TYPE set(int i, TYPE type)
set
in interface List<TYPE extends HasId<ID>>
public Object[] toArray()
toArray
in interface Collection<TYPE extends HasId<ID>>
toArray
in interface List<TYPE extends HasId<ID>>
public <T> T[] toArray(T[] ts)
toArray
in interface Collection<TYPE extends HasId<ID>>
toArray
in interface List<TYPE extends HasId<ID>>
public boolean remove(Object o)
remove
in interface Collection<TYPE extends HasId<ID>>
remove
in interface List<TYPE extends HasId<ID>>
public boolean containsAll(Collection<?> objects)
containsAll
in interface Collection<TYPE extends HasId<ID>>
containsAll
in interface List<TYPE extends HasId<ID>>
public boolean addAll(Collection<? extends TYPE> types)
addAll
in interface Collection<TYPE extends HasId<ID>>
addAll
in interface List<TYPE extends HasId<ID>>
public boolean addAll(int i, Collection<? extends TYPE> types)
addAll
in interface List<TYPE extends HasId<ID>>
public boolean removeAll(Collection<?> objects)
removeAll
in interface Collection<TYPE extends HasId<ID>>
removeAll
in interface List<TYPE extends HasId<ID>>
public boolean retainAll(Collection<?> objects)
retainAll
in interface Collection<TYPE extends HasId<ID>>
retainAll
in interface List<TYPE extends HasId<ID>>
public void clear()
clear
in interface Collection<TYPE extends HasId<ID>>
clear
in interface List<TYPE extends HasId<ID>>
public TYPE remove(int index)
remove
in interface List<TYPE extends HasId<ID>>
public int indexOf(Object o)
indexOf
in interface List<TYPE extends HasId<ID>>
public int lastIndexOf(Object o)
lastIndexOf
in interface List<TYPE extends HasId<ID>>
public ListIterator<TYPE> listIterator()
listIterator
in interface List<TYPE extends HasId<ID>>
public ListIterator<TYPE> listIterator(int i)
listIterator
in interface List<TYPE extends HasId<ID>>
public List<TYPE> subList(int i, int i1)
subList
in interface List<TYPE extends HasId<ID>>
public void refresh()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |