36 lines
742 B
Java
36 lines
742 B
Java
package com.sunyard.task;
|
|
|
|
public class TaskOutcome<T> {
|
|
private final TaskContext<T> context;
|
|
private final T result;
|
|
private final Throwable error;
|
|
|
|
public TaskOutcome(TaskContext<T> context, T result) {
|
|
this.context = context;
|
|
this.result = result;
|
|
this.error = null;
|
|
}
|
|
|
|
public TaskOutcome(TaskContext<T> context, Throwable error) {
|
|
this.context = context;
|
|
this.result = null;
|
|
this.error = error;
|
|
}
|
|
|
|
public boolean isSuccess() {
|
|
return error == null;
|
|
}
|
|
|
|
public TaskContext<T> getContext() {
|
|
return context;
|
|
}
|
|
|
|
public T getResult() {
|
|
return result;
|
|
}
|
|
|
|
public Throwable getError() {
|
|
return error;
|
|
}
|
|
}
|