1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.argeo.slc.diff;
17
18 import org.argeo.slc.SlcException;
19
20
21 public class DiffNotMatched extends DiffIssueKey {
22
23
24
25
26
27 private Object expected;
28 private Object reached;
29
30 public DiffNotMatched(DiffPosition position, Object expected, Object reached) {
31 super(position);
32 this.expected = expected;
33 this.reached = reached;
34 }
35
36 public DiffNotMatched(DiffPosition position, Object expected,
37 Object reached, DiffKey key) {
38 super(position, key);
39 this.expected = expected;
40 this.reached = reached;
41 }
42
43 public Object getExpected() {
44 return expected;
45 }
46
47 public Object getReached() {
48 return reached;
49 }
50
51 @Override
52 public String toString() {
53 String result = position + ": not matched " + expected + " <> "
54 + reached;
55 if (super.key != null) {
56 result = result + " - Key: " + super.toString();
57 }
58
59 return result;
60 }
61
62 @SuppressWarnings("unused")
63 private String getExpectedStr() {
64 if (expected instanceof String)
65 return (String) expected;
66 else
67 throw new SlcException(
68 "Object 'expected' is of wrong type. Must be a String");
69 }
70
71 @SuppressWarnings("unused")
72 private String getReachedStr() {
73 if (reached instanceof String)
74 return (String) reached;
75 else
76 throw new SlcException(
77 "Object 'reached' is of wrong type. Must be a String");
78 }
79
80 @SuppressWarnings("unused")
81 private void setReachedStr(String reachedStr) {
82 this.reached = reachedStr;
83 }
84
85 @SuppressWarnings("unused")
86 private void setExpectedStr(String expectedStr) {
87 this.expected = expectedStr;
88 }
89
90 }