Skip to content

Method: ExceptionalTaskResult(Exception)

1: package de.fhdw.wtf.common.task.result;
2:
3: import de.fhdw.wtf.common.task.result.visitor.TaskResultVisitor;
4:
5: /**
6: * Negative result of a {@link de.fhdw.wtf.common.task.Task}.
7: *
8: */
9: public class ExceptionalTaskResult implements TaskResult {
10:         
11:         /**
12:          * Exception.
13:          */
14:         private final Exception e;
15:         
16:         /**
17:          * Constructor of {@link ExceptionalTaskResult}.
18:          *
19:          * @param e
20:          * exception
21:          */
22:         public ExceptionalTaskResult(final Exception e) {
23:                 this.e = e;
24:         }
25:         
26:         /**
27:          * Returns the reason for the negative result of the task.
28:          *
29:          * @return exception
30:          */
31:         public Exception getError() {
32:                 return this.e;
33:         }
34:         
35:         @Override
36:         public void accept(final TaskResultVisitor v) {
37:                 v.handleExceptionalTaskResult(this);
38:         }
39:         
40: }