Modifier and Type | Class and Description |
---|---|
static class |
JobStatus.Tag
Discriminating tag type for
JobStatus . |
Modifier and Type | Field and Description |
---|---|
static JobStatus |
COMPLETE
The asynchronous job has finished.
|
static JobStatus |
IN_PROGRESS
The asynchronous job is still in progress.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
static JobStatus |
failed(JobError value)
Returns an instance of
JobStatus that has its tag set to JobStatus.Tag.FAILED . |
JobError |
getFailedValue()
The asynchronous job returned an error.
|
int |
hashCode() |
boolean |
isComplete()
|
boolean |
isFailed()
|
boolean |
isInProgress()
|
JobStatus.Tag |
tag()
Returns the tag for this instance.
|
String |
toString() |
String |
toStringMultiline()
Returns a String representation of this object formatted for easier
readability.
|
public static final JobStatus IN_PROGRESS
public static final JobStatus COMPLETE
public JobStatus.Tag tag()
This class is a tagged union. Tagged unions instances are always
associated to a specific tag. This means only one of the isXyz()
methods will return true
. Callers are recommended to use the tag
value in a switch
statement to properly handle the different
values for this JobStatus
.
public boolean isInProgress()
true
if this instance is tagged as JobStatus.Tag.IN_PROGRESS
, false
otherwise.public boolean isComplete()
true
if this instance is tagged as JobStatus.Tag.COMPLETE
,
false
otherwise.public boolean isFailed()
true
if this instance is tagged as JobStatus.Tag.FAILED
,
false
otherwise.public static JobStatus failed(JobError value)
JobStatus
that has its tag set to JobStatus.Tag.FAILED
.
The asynchronous job returned an error.
value
- value to assign to this instance.JobStatus
with its tag set to JobStatus.Tag.FAILED
.IllegalArgumentException
- if value
is null
.public JobError getFailedValue()
This instance must be tagged as JobStatus.Tag.FAILED
.
JobError
value associated with this instance if
isFailed()
is true
.IllegalStateException
- If isFailed()
is false
.public String toStringMultiline()
The returned String may contain newlines.