public final class TaskResult extends java.lang.Object implements Writeable, ToXContentObject
getTask() while
tasks with stored result will have either a getError() or getResponse().Writeable.Reader<V>, Writeable.Writer<V>ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params| Modifier and Type | Field and Description |
|---|---|
static ConstructingObjectParser<TaskResult,java.lang.Void> |
PARSER |
EMPTY_PARAMS| Constructor and Description |
|---|
TaskResult(boolean completed,
TaskInfo task)
Construct a TaskResult for a task for which we don't have a result or error.
|
TaskResult(StreamInput in)
Read from a stream.
|
TaskResult(TaskInfo task,
java.lang.Exception error)
Construct a TaskResult for a task that completed with an error.
|
TaskResult(TaskInfo task,
ToXContent response)
Construct a TaskResult for a task that completed successfully.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
BytesReference |
getError()
Get the error that finished this task.
|
java.util.Map<java.lang.String,java.lang.Object> |
getErrorAsMap()
Convert
getError() from XContent to a Map for easy processing. |
BytesReference |
getResponse()
Get the response that this task finished with.
|
java.util.Map<java.lang.String,java.lang.Object> |
getResponseAsMap()
Convert
getResponse() from XContent to a Map for easy processing. |
TaskInfo |
getTask()
Get the task that this wraps.
|
int |
hashCode() |
XContentBuilder |
innerToXContent(XContentBuilder builder,
ToXContent.Params params) |
boolean |
isCompleted() |
java.lang.String |
toString() |
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
void |
writeTo(StreamOutput out)
Write this into the StreamOutput.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitisFragmentpublic static final ConstructingObjectParser<TaskResult,java.lang.Void> PARSER
public TaskResult(boolean completed,
TaskInfo task)
public TaskResult(TaskInfo task, java.lang.Exception error) throws java.io.IOException
java.io.IOExceptionpublic TaskResult(TaskInfo task, ToXContent response) throws java.io.IOException
java.io.IOExceptionpublic TaskResult(StreamInput in) throws java.io.IOException
java.io.IOExceptionpublic void writeTo(StreamOutput out) throws java.io.IOException
Writeablepublic TaskInfo getTask()
public BytesReference getError()
public java.util.Map<java.lang.String,java.lang.Object> getErrorAsMap()
getError() from XContent to a Map for easy processing. Will return an empty map if the task didn't finish with an
error, hasn't yet finished, or didn't store its result.public BytesReference getResponse()
public java.util.Map<java.lang.String,java.lang.Object> getResponseAsMap()
getResponse() from XContent to a Map for easy processing. Will return an empty map if the task was finished with an
error, hasn't yet finished, or didn't store its result.public boolean isCompleted()
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
toXContent in interface ToXContentjava.io.IOExceptionpublic XContentBuilder innerToXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
java.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object