1 | |
package org.apache.commons.contract; |
2 | |
|
3 | |
import java.util.HashMap; |
4 | |
import java.util.Map; |
5 | |
|
6 | |
import org.apache.commons.contract.descriptor.StateDescriptor; |
7 | |
|
8 | |
public class Result { |
9 | 0 | public final static Result OK = new Result(StateDescriptor.OK); |
10 | |
|
11 | |
protected String state; |
12 | |
protected Map resultEntries; |
13 | |
|
14 | 0 | public Result(String state) { |
15 | 0 | this.state = state; |
16 | 0 | resultEntries = new HashMap(); |
17 | 0 | } |
18 | |
|
19 | |
public Result(String state, String key, Object value) { |
20 | 0 | this(state); |
21 | 0 | addResultEntry(key, value); |
22 | 0 | } |
23 | |
|
24 | 0 | public Result(String state, Map resultEntries) { |
25 | 0 | this.state = state; |
26 | 0 | this.resultEntries = resultEntries; |
27 | 0 | } |
28 | |
|
29 | |
public void setState(String state) { |
30 | 0 | this.state = state; |
31 | 0 | } |
32 | |
|
33 | |
public String getState() { |
34 | 0 | return state; |
35 | |
} |
36 | |
|
37 | |
public Map getResultEntries() { |
38 | 0 | return resultEntries; |
39 | |
} |
40 | |
|
41 | |
public void addResultEntry(String key, Object value) { |
42 | 0 | resultEntries.put(key, value); |
43 | 0 | } |
44 | |
} |