org.datanucleus.store.query
Class CandidateIdsQueryResult

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList
          extended by org.datanucleus.store.query.AbstractQueryResult
              extended by org.datanucleus.store.query.CandidateIdsQueryResult
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable, java.util.Collection, java.util.List, QueryResult

public class CandidateIdsQueryResult
extends AbstractQueryResult

QueryResult taking in the list of identities of the objects of candidate type. This is used where we cached the results of a query (the "ids") and just want to materialise them. User can define the query extension "datanucleus.query.resultCache.type" to define the type of internal caching of objects once they are found. User can also define whether the returned objects are validated against the datastore upon retrieval using the query extension "datanucleus.query.resultCache.validateObjects" (default=true)

See Also:
Serialized Form

Nested Class Summary
 class CandidateIdsQueryResult.ResultIterator
          Iterator for results for this query.
 
Field Summary
 
Fields inherited from class org.datanucleus.store.query.AbstractQueryResult
closed, connectionListeners, loadResultsAtCommit, LOCALISER, query, resultSizeMethod, size
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
CandidateIdsQueryResult(Query query, java.util.List<java.lang.Object> ids)
           
 
Method Summary
protected  void closeResults()
          Inform the query result that we are closing the results now.
protected  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)
          Convenience method to get the object for a particular index.
 java.util.Iterator iterator()
          Accessor for an iterator for the results.
 java.util.ListIterator listIterator()
          Accessor for a list iterator for the results.
 
Methods inherited from class org.datanucleus.store.query.AbstractQueryResult
add, add, addAll, addConnectionListener, assertIsOpen, clear, close, contains, containsAll, disconnect, getSizeUsingMethod, hashCode, indexOf, isEmpty, isOpen, lastIndexOf, remove, set, size, 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 java.util.Collection
addAll, remove, removeAll, retainAll
 
Methods inherited from interface java.util.List
addAll, remove, removeAll, retainAll
 

Constructor Detail

CandidateIdsQueryResult

public CandidateIdsQueryResult(Query query,
                               java.util.List<java.lang.Object> ids)
Method Detail

closeResults

protected void closeResults()
Description copied from class: AbstractQueryResult
Inform the query result that we are closing the results now.

Specified by:
closeResults in class AbstractQueryResult

closingConnection

protected void closingConnection()
Description copied from class: AbstractQueryResult
Inform the query result that the connection is being closed so perform any operations now, or rest in peace.

Specified by:
closingConnection in class AbstractQueryResult

equals

public boolean equals(java.lang.Object o)
Description copied from class: AbstractQueryResult
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 interface java.util.List
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)
Description copied from class: AbstractQueryResult
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

iterator

public java.util.Iterator iterator()
Description copied from class: AbstractQueryResult
Accessor for an iterator for the results.

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

listIterator

public java.util.ListIterator listIterator()
Description copied from class: AbstractQueryResult
Accessor for a list iterator for the results.

Specified by:
listIterator in interface java.util.List
Specified by:
listIterator in class AbstractQueryResult
Returns:
a ListIterator with the query results

getObjectForIndex

protected java.lang.Object getObjectForIndex(int index)
Convenience method to get the object for a particular index. Loads the object as required, or takes it from the internal cache (if present). Stores the returned object in the internal cache (if present).

Parameters:
index - The index
Returns:
The object


Copyright © 2010. All Rights Reserved.