Class CandidateIdsQueryResult<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
org.datanucleus.store.query.AbstractQueryResult<E>
org.datanucleus.store.query.CandidateIdsQueryResult<E>
- All Implemented Interfaces:
Serializable, Iterable<E>, Collection<E>, List<E>, QueryResult<E>
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassIterator for results for this query. -
Field Summary
FieldsModifier and TypeFieldDescriptionList of identities of the candidate objects.(package private) booleanWhether to validate the objects if getting from the cache.Fields inherited from class AbstractQueryResult
api, closed, connectionListeners, loadResultsAtCommit, query, resultSizeMethod, sizeFields inherited from class AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidInform the query result that we are closing the results now.protected voidInform the query result that the connection is being closed so perform any operations now, or rest in peace.booleanEquality operator for QueryResults.get(int index) Method to retrieve a particular element from the list.protected EgetObjectForIndex(int index) Convenience method to get the object for a particular index.inthashCode()Accessor for the hashcode of this objectiterator()Accessor for an iterator for the results.Accessor for a list iterator for the results.protected ObjectHandle serialisation by returning a java.util.ArrayList of all of the results for this query after disconnecting the query which has the consequence of enforcing the load of all objects.Methods inherited from class AbstractQueryResult
add, add, addAll, addConnectionListener, assertIsOpen, clear, close, contains, containsAll, disconnect, getSizeUsingMethod, indexOf, isEmpty, isOpen, lastIndexOf, remove, set, size, subList, toArray, toArrayMethods inherited from class AbstractList
listIterator, removeRangeMethods inherited from interface Collection
parallelStream, removeIf, streamMethods inherited from interface List
addAll, remove, removeAll, replaceAll, retainAll, sort, spliterator
-
Field Details
-
ids
-
results
-
validateObjects
boolean validateObjectsWhether to validate the objects if getting from the cache.
-
-
Constructor Details
-
CandidateIdsQueryResult
-
-
Method Details
-
closeResults
protected void closeResults()Description copied from class:AbstractQueryResultInform the query result that we are closing the results now.- Specified by:
closeResultsin classAbstractQueryResult<E>
-
closingConnection
protected void closingConnection()Description copied from class:AbstractQueryResultInform the query result that the connection is being closed so perform any operations now, or rest in peace.- Specified by:
closingConnectionin classAbstractQueryResult<E>
-
equals
Description copied from class:AbstractQueryResultEquality operator for QueryResults. Overrides the AbstractList implementation since that uses size() and iterator() and that would cause problems when closed.- Specified by:
equalsin interfaceCollection<E>- Specified by:
equalsin interfaceList<E>- Specified by:
equalsin classAbstractQueryResult<E>- Parameters:
o- The object to compare against- Returns:
- Whether they are equal
-
hashCode
public int hashCode()Description copied from class:AbstractQueryResultAccessor for the hashcode of this object- Specified by:
hashCodein interfaceCollection<E>- Specified by:
hashCodein interfaceList<E>- Overrides:
hashCodein classAbstractQueryResult<E>- Returns:
- The hash code
-
get
Description copied from class:AbstractQueryResultMethod to retrieve a particular element from the list. -
iterator
Description copied from class:AbstractQueryResultAccessor for an iterator for the results. -
listIterator
Description copied from class:AbstractQueryResultAccessor for a list iterator for the results.- Specified by:
listIteratorin interfaceList<E>- Specified by:
listIteratorin classAbstractQueryResult<E>- Returns:
- a ListIterator with the query results
-
getObjectForIndex
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
-
writeReplace
Handle serialisation by returning a java.util.ArrayList of all of the results for this query after disconnecting the query which has the consequence of enforcing the load of all objects.- Returns:
- The object to serialise
- Throws:
ObjectStreamException- if an error occurs
-