|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.midao.jdbc.core.handlers.model.QueryParametersLazyList
public class QueryParametersLazyList
Lazy query output list implementation. Is used to handle ResultSets returned from Query Execution. Currently amount of cache is unlimited. In order to make it more memory friendly - please specify it via Constructor.
It is recommended to use iterator()
to iterate through this list in QueryParametersLazyList.Type.READ_ONLY_FORWARD
mode (default mode).
Also please be aware that first element it returns is not statement params, but actually first value from ResultSet.
get(int)
returns null if no value was found by that index. In future exception might be thrown instead.
This is reference implementation and is under active development
Nested Class Summary | |
---|---|
static class |
QueryParametersLazyList.Type
Allowed types of Lazy query output list implementation |
Constructor Summary | |
---|---|
QueryParametersLazyList(java.sql.Statement stmt,
TypeHandler typeHandler,
boolean readGeneratedKeys)
Creates new QueryParametersLazyList instance |
|
QueryParametersLazyList(java.sql.Statement stmt,
TypeHandler typeHandler,
boolean readGeneratedKeys,
int maxCacheSize)
Creates new QueryParametersLazyList instance |
|
QueryParametersLazyList(java.sql.Statement stmt,
TypeHandler typeHandler,
boolean readGeneratedKeys,
QueryParametersLazyList.Type type,
int maxCacheSize)
Creates new QueryParametersLazyList instance |
Method Summary | ||
---|---|---|
void |
add(int index,
QueryParameters element)
Currently usage is not allowed. |
|
boolean |
add(QueryParameters queryParameters)
Currently usage is not allowed. |
|
boolean |
addAll(java.util.Collection<? extends QueryParameters> c)
Currently usage is not allowed. |
|
boolean |
addAll(int index,
java.util.Collection<? extends QueryParameters> c)
Currently usage is not allowed. |
|
void |
clear()
Currently usage is not allowed. |
|
void |
close()
Performs cleanup of all resources used by this lazy query output list implementation: Statement and ResultSet |
|
boolean |
contains(java.lang.Object o)
|
|
boolean |
containsAll(java.util.Collection<?> c)
Currently usage is not allowed. |
|
QueryParameters |
get(int index)
Returns element at specified position. |
|
int |
indexOf(java.lang.Object o)
Currently usage is not allowed. |
|
boolean |
isEmpty()
Checks if cache list is empty |
|
java.util.Iterator<QueryParameters> |
iterator()
Returns iterator of this lazy query output list implementation. |
|
int |
lastIndexOf(java.lang.Object o)
Currently usage is not allowed. |
|
java.util.ListIterator<QueryParameters> |
listIterator()
Currently usage is not allowed. |
|
java.util.ListIterator<QueryParameters> |
listIterator(int index)
Currently usage is not allowed. |
|
QueryParameters |
remove(int index)
Currently usage is not allowed. |
|
boolean |
remove(java.lang.Object o)
Currently usage is not allowed. |
|
boolean |
removeAll(java.util.Collection<?> c)
Currently usage is not allowed. |
|
boolean |
retainAll(java.util.Collection<?> c)
Currently usage is not allowed. |
|
QueryParameters |
set(int index,
QueryParameters element)
Sets value in cache. |
|
void |
setMaxCacheSize(int maxCacheSize)
Sets maximum cache size for this instance. |
|
int |
size()
Function is not allowed to be executed as Lazy query output doesn't know the size of output. |
|
int |
sizeCached()
Returns amount of elements cached (inc. |
|
java.util.List<QueryParameters> |
subList(int fromIndex,
int toIndex)
Execution is currently not allowed, as it might result in caching whole query output which would lead to huge memory usage and/or crash. |
|
java.util.List<QueryParameters> |
subListCached(int fromIndex,
int toIndex)
Returns sublist of cached elements. |
|
java.lang.Object[] |
toArray()
Function is not allowed to be executed, as it might result in caching whole query output which would lead to huge memory usage and/or crash. |
|
|
toArray(T[] a)
The same as toArray() . |
|
java.lang.Object[] |
toArrayCached()
Returns array of cached elements (inc. |
|
|
toArrayCached(T[] a)
The same as toArrayCached() . |
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 |
Constructor Detail |
---|
public QueryParametersLazyList(java.sql.Statement stmt, TypeHandler typeHandler, boolean readGeneratedKeys, QueryParametersLazyList.Type type, int maxCacheSize) throws java.sql.SQLException
stmt
- SQL StatementtypeHandler
- Type handler which would be used to process rows after readreadGeneratedKeys
- specifies if generated keys should be cached right awaytype
- lazy list type
java.sql.SQLException
public QueryParametersLazyList(java.sql.Statement stmt, TypeHandler typeHandler, boolean readGeneratedKeys, int maxCacheSize) throws java.sql.SQLException
stmt
- SQL StatementtypeHandler
- Type handler which would be used to process rows after readreadGeneratedKeys
- specifies if generated keys should be cached right awaymaxCacheSize
- maximum cache size
java.sql.SQLException
public QueryParametersLazyList(java.sql.Statement stmt, TypeHandler typeHandler, boolean readGeneratedKeys) throws java.sql.SQLException
stmt
- SQL StatementtypeHandler
- Type handler which would be used to process rows after readreadGeneratedKeys
- specifies if generated keys should be cached right away
java.sql.SQLException
Method Detail |
---|
public void setMaxCacheSize(int maxCacheSize)
maxCacheSize
- new max cache sizepublic boolean isEmpty()
isEmpty
in interface java.util.Collection<QueryParameters>
isEmpty
in interface java.util.List<QueryParameters>
public int size()
size
in interface java.util.Collection<QueryParameters>
size
in interface java.util.List<QueryParameters>
public int sizeCached()
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection<QueryParameters>
toArray
in interface java.util.List<QueryParameters>
public java.lang.Object[] toArrayCached()
public <T> T[] toArray(T[] a)
toArray()
. Currently execution is not allowed. Might be changed in future
toArray
in interface java.util.Collection<QueryParameters>
toArray
in interface java.util.List<QueryParameters>
a
- the array into which the elements of this list are to be stored, if it is big enough;
otherwise, a new array of the same runtime type is allocated for this purpose.
public <T> T[] toArrayCached(T[] a)
toArrayCached()
. Returns array of cached elements(inc. header as first element)
as array of Type T.
a
- the array into which the elements of this list are to be stored, if it is big enough;
otherwise, a new array of the same runtime type is allocated for this purpose.
public java.util.List<QueryParameters> subList(int fromIndex, int toIndex)
subList
in interface java.util.List<QueryParameters>
List#subList(int, int)}
public java.util.List<QueryParameters> subListCached(int fromIndex, int toIndex)
fromIndex
- low endpoint (inclusive) of the subListtoIndex
- high endpoint (exclusive) of the subList
public QueryParameters get(int index)
get
in interface java.util.List<QueryParameters>
index
- index of the element to return
List#get(int)}
public void close()
Statement
and ResultSet
public java.util.Iterator<QueryParameters> iterator()
iterator
in interface java.lang.Iterable<QueryParameters>
iterator
in interface java.util.Collection<QueryParameters>
iterator
in interface java.util.List<QueryParameters>
Iterator
instancepublic QueryParameters set(int index, QueryParameters element)
set
in interface java.util.List<QueryParameters>
index
- element number to replaceelement
- new element value
MidaoRuntimeException
- if value is not in cachepublic java.util.ListIterator<QueryParameters> listIterator()
listIterator
in interface java.util.List<QueryParameters>
MidaoRuntimeException
public java.util.ListIterator<QueryParameters> listIterator(int index)
listIterator
in interface java.util.List<QueryParameters>
MidaoRuntimeException
public boolean add(QueryParameters queryParameters)
add
in interface java.util.Collection<QueryParameters>
add
in interface java.util.List<QueryParameters>
MidaoRuntimeException
public boolean addAll(java.util.Collection<? extends QueryParameters> c)
addAll
in interface java.util.Collection<QueryParameters>
addAll
in interface java.util.List<QueryParameters>
MidaoRuntimeException
public boolean addAll(int index, java.util.Collection<? extends QueryParameters> c)
addAll
in interface java.util.List<QueryParameters>
MidaoRuntimeException
public void add(int index, QueryParameters element)
add
in interface java.util.List<QueryParameters>
MidaoRuntimeException
public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection<QueryParameters>
remove
in interface java.util.List<QueryParameters>
MidaoRuntimeException
public QueryParameters remove(int index)
remove
in interface java.util.List<QueryParameters>
MidaoRuntimeException
public boolean removeAll(java.util.Collection<?> c)
removeAll
in interface java.util.Collection<QueryParameters>
removeAll
in interface java.util.List<QueryParameters>
MidaoRuntimeException
public boolean retainAll(java.util.Collection<?> c)
retainAll
in interface java.util.Collection<QueryParameters>
retainAll
in interface java.util.List<QueryParameters>
MidaoRuntimeException
public void clear()
clear
in interface java.util.Collection<QueryParameters>
clear
in interface java.util.List<QueryParameters>
MidaoRuntimeException
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection<QueryParameters>
contains
in interface java.util.List<QueryParameters>
public boolean containsAll(java.util.Collection<?> c)
containsAll
in interface java.util.Collection<QueryParameters>
containsAll
in interface java.util.List<QueryParameters>
MidaoRuntimeException
public int indexOf(java.lang.Object o)
indexOf
in interface java.util.List<QueryParameters>
MidaoRuntimeException
public int lastIndexOf(java.lang.Object o)
lastIndexOf
in interface java.util.List<QueryParameters>
MidaoRuntimeException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |