com.solarmetric.kodo.impl.jdbc.runtime
Class LazyResultList
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractList
|
+--com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList
- All Implemented Interfaces:
- Collection, CustomResultList, List, ResultList, Serializable
- public class LazyResultList
- extends AbstractList
- implements CustomResultList
Lazy ResultList implementation. It maintains a SoftValueMap of
the rows that we have already instantiated. If we ever resolve all
of the values in the ResultSet, they will be copied over to a
HashMap so that the ResultSet and Statement can be closed.
This implementation does not invoke the
ResultObjectProvider.open(java.lang.Object) or ResultObjectProvider.advance(java.lang.Object)
APIs. Instead, it manipulates the underlying ResultSet
directly.
- Since:
- 2.2.6
- See Also:
- Serialized Form
| Methods inherited from class java.util.AbstractList |
add, add, addAll, clear, indexOf, lastIndexOf, listIterator, remove, removeRange, set, subList |
| Methods inherited from interface java.util.List |
add, add, addAll, addAll, clear, contains, containsAll, indexOf, isEmpty, lastIndexOf, listIterator, remove, remove, removeAll, retainAll, set, subList, toArray, toArray |
SIZE_UNINITIALIZED
public static final int SIZE_UNINITIALIZED
SIZE_UNKNOWN
public static final int SIZE_UNKNOWN
LazyResultList
public LazyResultList()
LazyResultList
LazyResultList(ResultSet rs,
ResultObjectProvider rop,
Configuration config)
throws SQLException
initResultList
public void initResultList(Object input,
ResultObjectProvider rop,
Configuration config)
- Description copied from interface:
CustomResultList
- Initialize the ResultList implementation, which will allow
custom ResultList objects to be used for Query results.
- Specified by:
initResultList in interface CustomResultList
- Following copied from interface:
com.solarmetric.kodo.runtime.objectprovider.CustomResultList
- Parameters:
input - the source of the results (e.g., a JDBC ResultSet)rop - the provider used to obtain the next element
from the listconfig - the Configuration object to use
toString
public String toString()
- Overrides:
toString in class AbstractCollection
getInstantiatedCount
public int getInstantiatedCount()
- Description copied from interface:
ResultList
- Returns the number of objects that are currently instantiated
internally in this list.
- Specified by:
getInstantiatedCount in interface ResultList
getCacheSize
public int getCacheSize()
getCacheValues
protected Collection getCacheValues()
get
public Object get(int index)
- Specified by:
get in interface List- Overrides:
get in class AbstractList
flush
public void flush(int targetReduction)
- Internal method to try to flush out all references that are
not present elsewhere.
useWeakMap
public void useWeakMap()
useSoftMap
public void useSoftMap()
size
public int size()
- Return the size of this List. Since at any given time, only some
(or none) of the results may be cached, we calculate the size by
jumping to the last row in the ResultSet and getting its row
index: this will be the correct size, according to the JDBC 2.0
specification.
- Specified by:
size in interface List- Overrides:
size in class AbstractCollection
getSize
protected int getSize()
throws SQLException
- Return the size of the result set in this ResultList. This
should not return cached values.
checkClosed
public void checkClosed()
- Description copied from interface:
ResultList
- Check to see if this ResultList has been closed, and if so,
throw a JDOUserException.
- Specified by:
checkClosed in interface ResultList
close
public void close()
- Description copied from interface:
ResultList
- Close the list.
- Specified by:
close in interface ResultList
finalize
protected void finalize()
throws Throwable
- Overrides:
finalize in class Object
free
protected void free()
iterator
public Iterator iterator()
- Specified by:
iterator in interface List- Overrides:
iterator in class AbstractList
listIterator
public ListIterator listIterator()
- Specified by:
listIterator in interface List- Overrides:
listIterator in class AbstractList
isClosed
public boolean isClosed()
- Description copied from interface:
ResultList
- Returns true if the list has been closed.
- Specified by:
isClosed in interface ResultList
writeReplace
public Object writeReplace()
throws ObjectStreamException
hashCode
public int hashCode()
- Returns the hashCode of an internally held identity object,
so that the entire list does not need to be traversed
in order to calculate the hashCode.
- Specified by:
hashCode in interface List- Overrides:
hashCode in class AbstractList
equals
public boolean equals(Object other)
- Specified by:
equals in interface List- Overrides:
equals in class AbstractList
Copyright 2001,2002,2003 SolarMetric, Inc. All Rights Reserved.