]> git.argeo.org Git - gpl/argeo-slc.git/blob - cms/org.argeo.slc.support/src/org/argeo/slc/diff/DiffNotMatched.java
Clarify SLC project structure.
[gpl/argeo-slc.git] / cms / org.argeo.slc.support / src / org / argeo / slc / diff / DiffNotMatched.java
1 package org.argeo.slc.diff;
2
3 import org.argeo.slc.SlcException;
4
5 /** Diff issue where reached and expected values are different. */
6 public class DiffNotMatched extends DiffIssueKey {
7
8 // To enable hibernate persistance, these object cannot be final
9 // private final Object expected;
10 // private final Object reached;
11
12 private Object expected;
13 private Object reached;
14
15 public DiffNotMatched(DiffPosition position, Object expected, Object reached) {
16 super(position);
17 this.expected = expected;
18 this.reached = reached;
19 }
20
21 public DiffNotMatched(DiffPosition position, Object expected,
22 Object reached, DiffKey key) {
23 super(position, key);
24 this.expected = expected;
25 this.reached = reached;
26 }
27
28 public Object getExpected() {
29 return expected;
30 }
31
32 public Object getReached() {
33 return reached;
34 }
35
36 @Override
37 public String toString() {
38 String result = position + ": not matched " + expected + " <> "
39 + reached;
40 if (super.key != null) {
41 result = result + " - Key: " + super.toString();
42 }
43
44 return result;
45 }
46
47 @SuppressWarnings("unused")
48 private String getExpectedStr() {
49 if (expected instanceof String)
50 return (String) expected;
51 else
52 throw new SlcException(
53 "Object 'expected' is of wrong type. Must be a String");
54 }
55
56 @SuppressWarnings("unused")
57 private String getReachedStr() {
58 if (reached instanceof String)
59 return (String) reached;
60 else
61 throw new SlcException(
62 "Object 'reached' is of wrong type. Must be a String");
63 }
64
65 @SuppressWarnings("unused")
66 private void setReachedStr(String reachedStr) {
67 this.reached = reachedStr;
68 }
69
70 @SuppressWarnings("unused")
71 private void setExpectedStr(String expectedStr) {
72 this.expected = expectedStr;
73 }
74
75 }