public abstract class SingletonQueryOperation extends QueryOperation<AbstractObject>
object
.
These are, for example, operations that retrieve objects by ID or locator.QueryOperation.DataEqualOperation
AbstractOperation.OperationConstructor, AbstractOperation.OperationName
suppData, uuidOperationComparator
Modifier | Constructor and Description |
---|---|
protected |
SingletonQueryOperation()
Creates a new instance of SingletonQueryOperation.
|
protected |
SingletonQueryOperation(AnswerType answerType)
Creates a new instance of ListingQueryOperation.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addToAnswer(AbstractObject object)
Add an object to the answer.
|
SingletonQueryOperation |
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.
|
AbstractObject |
getAnswerObject()
Returns an object that is the answer to this query.
|
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.
|
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 SingletonQueryOperation()
cleared and cloned
.protected SingletonQueryOperation(AnswerType answerType)
answerType
- the type of object this operation stores in its answerpublic SingletonQueryOperation 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 AbstractObject getAnswerObject()
public 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()
resetAnswer
in class QueryOperation<AbstractObject>
public 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 one