org.jpox.store.query
Class InsensitiveQueryResult

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byorg.jpox.store.query.AbstractQueryResult
              extended byorg.jpox.store.query.InsensitiveQueryResult
All Implemented Interfaces:
java.util.Collection, java.util.List, Queryable, QueryResult, java.io.Serializable

public final class InsensitiveQueryResult
extends AbstractQueryResult
implements QueryResult, java.io.Serializable

Lazy collection results from a Query with the ResultSet insensitive to direction. The actual result elements are only loaded when accessed. Once a result has been loaded it will be stored in a local cache for any subsequent access.

Version:
$Revision: 1.19 $
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jpox.store.query.AbstractQueryResult
closed, LOCALISER, qs, query, rof, rs
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
InsensitiveQueryResult(QueryExpression qs, Query query, Query.ResultObjectFactory rof, java.sql.ResultSet rs, java.util.Collection candidates)
          Constructor of the result from a Query.
 
Method Summary
 void close()
          Method to close the results.
 void closingConnection()
          Inform the query result that the connection is being closed so perform any operations now, or rest in peace.
 boolean equals(java.lang.Object o)
          Equality operator for QueryResults.
 java.lang.Object get(int index)
          Method to retrieve a particular element from the list.
protected  java.lang.Object getObjectForIndex(int index)
          Accessor for the result object at an index.
 boolean isEmpty()
          Returns true if this collection contains no elements.
 java.util.Iterator iterator()
          Accessor for an iterator for the results.
 java.util.ListIterator listIterator()
          Accessor for an iterator for the results.
 int size()
          Method to return the size of the result set.
 
Methods inherited from class org.jpox.store.query.AbstractQueryResult
add, add, addAll, assertIsOpen, clear, closeResultSet, contains, containsAll, hashCode, indexOf, isOpen, lastIndexOf, newQueryStatement, newQueryStatement, newResultObjectFactory, remove, set, subList, toArray, toArray
 
Methods inherited from class java.util.AbstractList
listIterator, removeRange
 
Methods inherited from class java.util.AbstractCollection
addAll, remove, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jpox.store.query.Queryable
newQueryStatement, newQueryStatement, newResultObjectFactory
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, hashCode, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from interface java.util.List
addAll, remove, removeAll, retainAll
 

Constructor Detail

InsensitiveQueryResult

public InsensitiveQueryResult(QueryExpression qs,
                              Query query,
                              Query.ResultObjectFactory rof,
                              java.sql.ResultSet rs,
                              java.util.Collection candidates)
Constructor of the result from a Query.

Parameters:
qs - The Query Statement
query - The Query
rof - The factory to retrieve results from
rs - The ResultSet from the Query Statement
candidates - the Candidates collection. Pass this argument only when distinct = false
Method Detail

getObjectForIndex

protected java.lang.Object getObjectForIndex(int index)
Accessor for the result object at an index. If the object has already been processed will return that object, otherwise will retrieve the object using the factory.

Parameters:
index - The list index position
Returns:
The result object

close

public void close()
Method to close the results.

Specified by:
close in interface QueryResult
Overrides:
close in class AbstractQueryResult

closingConnection

public void closingConnection()
Inform the query result that the connection is being closed so perform any operations now, or rest in peace.

Specified by:
closingConnection in interface QueryResult

iterator

public java.util.Iterator iterator()
Accessor for an iterator for the results.

Specified by:
iterator in interface java.util.Collection
Specified by:
iterator in class AbstractQueryResult
Returns:
The iterator

listIterator

public java.util.ListIterator listIterator()
Accessor for an iterator for the results.

Specified by:
listIterator in interface java.util.List
Specified by:
listIterator in class AbstractQueryResult
Returns:
The iterator

equals

public boolean equals(java.lang.Object o)
Equality operator for QueryResults. Overrides the AbstractList implementation since that uses size() and iterator() and that would cause problems when closed.

Specified by:
equals in interface java.util.Collection
Specified by:
equals in class AbstractQueryResult
Parameters:
o - The object to compare against
Returns:
Whether they are equal

get

public java.lang.Object get(int index)
Method to retrieve a particular element from the list.

Specified by:
get in interface java.util.List
Specified by:
get in class AbstractQueryResult
Parameters:
index - The index of the element
Returns:
The element at index

isEmpty

public boolean isEmpty()
Returns true if this collection contains no elements.

Checks if the result set is empty.

Specified by:
isEmpty in interface Queryable
Specified by:
isEmpty in class AbstractQueryResult
Returns:
true if this collection contains no elements.

size

public int size()
Method to return the size of the result set.

Specified by:
size in interface java.util.Collection
Specified by:
size in class AbstractQueryResult
Returns:
The size of the result set.


Copyright © -2007 . All Rights Reserved.