public abstract class ListingQueryOperation extends QueryOperation<AbstractObject>
objects
.
These are, for example, operations that access objects from a bucket.QueryOperation.DataEqualOperation
AbstractOperation.OperationConstructor, AbstractOperation.OperationName
suppData, uuidOperationComparator
Modifier | Constructor and Description |
---|---|
protected |
ListingQueryOperation()
Creates a new instance of ListingQueryOperation.
|
protected |
ListingQueryOperation(AnswerType answerType)
Creates a new instance of ListingQueryOperation.
|
protected |
ListingQueryOperation(AnswerType answerType,
java.util.List<AbstractObject> answer)
Creates a new instance of ListingQueryOperation.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addToAnswer(AbstractObject object)
Add an object to the answer.
|
ListingQueryOperation |
clone(boolean preserveAnswer)
Create a duplicate of this operation.
|
java.util.Iterator<AbstractObject> |
getAnswer()
Returns an iterator over all objects in the answer to this query.
|
java.util.Iterator<AbstractObject> |
getAnswer(int skip,
int count)
Returns an iterator over all objects in the answer skipping the first
skip items and returning only count elements. |
java.lang.Class<? extends AbstractObject> |
getAnswerClass()
Returns the class of objects this operation stores in its answer.
|
int |
getAnswerCount()
Returns the number of objects in this query answer.
|
java.util.Iterator<AbstractObject> |
getAnswerObjects()
Returns an iterator over all
AbstractObject s in the answer to this query. |
java.util.Iterator<? extends AbstractObject> |
getSubAnswer(int index)
Returns an iterator over all objects in the answer sub-collection with the given index.
|
java.util.Iterator<? extends AbstractObject> |
getSubAnswer(java.lang.Object key)
Returns an iterator over all objects in the answer sub-collection with the given key.
|
int |
getSubAnswerCount()
Returns the number of answer sub-collections.
|
void |
resetAnswer()
Reset the current query answer.
|
void |
updateFrom(AbstractOperation operation)
Update the error code and answer of this operation from another operation.
|
protected void |
updateFrom(ListingQueryOperation operation)
Update the answer of this operation from a
ListingQueryOperation . |
protected void |
updateFrom(RankingQueryOperation operation)
Update the answer of this operation from a
RankingQueryOperation . |
protected void |
updateFrom(SingletonQueryOperation operation)
Update the answer of this operation from a
SingletonQueryOperation . |
appendErrorCode, clone, dataEquals, dataEqualsImpl, dataHashCode, endOperation, evaluate, getAllSubAnswers, getAnswerType, getQueryAnswer, iterator, setAnswerType, wasSuccessful
appendArguments, clearSurplusData, containsParameter, createOperation, endOperation, equals, getAnnotatedConstructor, getAnnotatedConstructor, getArgument, getArgumentCount, getArgumentString, getConstructorArgumentDescriptions, getConstructorArgumentDescriptions, getConstructorArguments, getConstructorArguments, getConstructorDescription, getErrorCode, getName, getName, getOperationID, getParameter, getParameter, getParameter, getParameterCount, getParameterMap, getParameterNames, getRequiredParameter, getRequiredParameter, hashCode, isErrorCode, isFinished, removeParameter, setParameter, toString
protected ListingQueryOperation()
ArrayList
is used to store the answer.
Objects added to answer are cleared and cloned
.protected ListingQueryOperation(AnswerType answerType)
ArrayList
is used to store the answer.answerType
- the type of objects this operation stores in its answerprotected ListingQueryOperation(AnswerType answerType, java.util.List<AbstractObject> answer)
answerType
- the type of objects this operation stores in its answeranswer
- the collection used for storing the answerpublic ListingQueryOperation clone(boolean preserveAnswer) throws java.lang.CloneNotSupportedException
QueryOperation
preserveAnswer
is true the answer is
not cloned but both this and the cloned operation share the same answer collection.clone
in class QueryOperation<AbstractObject>
preserveAnswer
- flag whether to clone the answer (false) or preserve
the same answer collection (true) in the cloned operationjava.lang.CloneNotSupportedException
- if the operation instance cannot be clonedpublic java.lang.Class<? extends AbstractObject> getAnswerClass()
getAnswerClass
in class QueryOperation<AbstractObject>
public int getAnswerCount()
getAnswerCount
in class QueryOperation<AbstractObject>
public java.util.Iterator<AbstractObject> getAnswer()
getAnswer
in class QueryOperation<AbstractObject>
public java.util.Iterator<AbstractObject> getAnswer(int skip, int count)
QueryOperation
skip
items and returning only count
elements. If count
is less than or equal to zero, all objects from the answer (except for
skip
) are returned.getAnswer
in class QueryOperation<AbstractObject>
skip
- number of answer objects to skipcount
- number of answer objects to iterate (maximally, actual number of results can be smaller)public java.util.Iterator<AbstractObject> getAnswerObjects()
QueryOperation
AbstractObject
s in the answer to this query.
This method unwraps the objects from the results.getAnswerObjects
in class QueryOperation<AbstractObject>
AbstractObject
s in the answer to this querypublic int getSubAnswerCount()
QueryOperation
getSubAnswerCount
in class QueryOperation<AbstractObject>
public java.util.Iterator<? extends AbstractObject> getSubAnswer(int index) throws java.lang.IndexOutOfBoundsException
QueryOperation
getSubAnswer
in class QueryOperation<AbstractObject>
index
- the index of the answer sub-collection to returnjava.lang.IndexOutOfBoundsException
- if the given index is negative or
greater or equal to QueryOperation.getSubAnswerCount()
public java.util.Iterator<? extends AbstractObject> getSubAnswer(java.lang.Object key)
QueryOperation
getSubAnswer
in class QueryOperation<AbstractObject>
key
- the key of the answer sub-collection to returnpublic boolean addToAnswer(AbstractObject object) throws java.lang.IllegalArgumentException
QueryOperation.answerType
.object
- the object to addtrue
if the object
has been added to the answer. Otherwise false
.java.lang.IllegalArgumentException
- if the object cannot be added to the answer, e.g. because it cannot be clonedpublic void resetAnswer()
getAnswerCount()
will return zero.resetAnswer
in class QueryOperation<AbstractObject>
public final void updateFrom(AbstractOperation operation) throws java.lang.IllegalArgumentException
updateFrom
in class AbstractOperation
operation
- the source operation from which to get the updatejava.lang.IllegalArgumentException
- if the answer of the specified operation is incompatible with this oneprotected void updateFrom(SingletonQueryOperation operation)
SingletonQueryOperation
.operation
- the source operation from which to get the updateprotected void updateFrom(ListingQueryOperation operation)
ListingQueryOperation
.operation
- the source operation from which to get the updateprotected void updateFrom(RankingQueryOperation operation)
RankingQueryOperation
.operation
- the source operation from which to get the update