Package com.yahoo.documentapi
Class Result
- java.lang.Object
-
- com.yahoo.documentapi.Result
-
public class Result extends java.lang.Object
The synchronous result of submitting an asynchronous operation. A result is either a success or not. If it is not a success, it will contain an explanation of why. Document repositories may return subclasses which contain more information.- Author:
- bratseth
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Result.ResultType
The types that a Result can have.
-
Constructor Summary
Constructors Constructor Description Result(long requestId)
Creates a successful resultResult(Result.ResultType type, java.lang.Error error)
Creates a unsuccessful result
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Error
getError()
Returns the error causes by this.long
getRequestId()
Returns the id of this operation.boolean
isSuccess()
Returns whether this operation is a success.Result.ResultType
type()
Returns the type of result.
-
-
-
Constructor Detail
-
Result
public Result(long requestId)
Creates a successful result- Parameters:
requestId
- the ID of the request
-
Result
public Result(Result.ResultType type, java.lang.Error error)
Creates a unsuccessful result- Parameters:
type
- the type of failureerror
- the error to encapsulate in this Result- See Also:
Result.ResultType
-
-
Method Detail
-
isSuccess
public boolean isSuccess()
Returns whether this operation is a success. If it is a success, the operation is accepted and one or more responses are guaranteed to arrive within this sessions timeout limit. If this is not a success, this operation has no further consequences.- Returns:
- true if success
-
getError
public java.lang.Error getError()
Returns the error causes by this. If this was not a success, this method always returns an error If this was a success, this method returns null.- Returns:
- the Error, or null
-
getRequestId
public long getRequestId()
Returns the id of this operation. The asynchronous response to this operation will contain the same id to allow clients who desire to, to match operations to responses.- Returns:
- the id of this operation
-
type
public Result.ResultType type()
Returns the type of result.- Returns:
- the type of result, typically if this is an error or a success, and what kind of error.
- See Also:
Result.ResultType
-
-