1 package ca.uhn.hl7v2.testpanel.model.conf;
2
3 import jakarta.xml.bind.annotation.XmlAccessType;
4 import jakarta.xml.bind.annotation.XmlAccessorType;
5 import jakarta.xml.bind.annotation.XmlElement;
6 import jakarta.xml.bind.annotation.XmlType;
7
8 import org.apache.commons.lang.ObjectUtils;
9 import org.apache.commons.lang.builder.HashCodeBuilder;
10
11 @XmlAccessorType(XmlAccessType.FIELD)
12 @XmlType(name = "Code")
13 public class Code {
14
15 @XmlElement(name="code")
16 private String myCode;
17
18 @XmlElement(name="displayName")
19 private String myDisplayName;
20
21 private transient Table myTable;
22
23 public Code() {
24 super();
25 }
26
27 public Code(String theCode, String theDisplayName) {
28 super();
29 myCode = theCode;
30 myDisplayName = theDisplayName;
31 }
32
33
34
35
36 @Override
37 public boolean equals(Object theObj) {
38 if (!(theObj instanceof Code)) {
39 return false;
40 }
41
42 return ObjectUtils.equals(myCode, ((Code)theObj).myCode);
43 }
44
45
46
47
48 public String getCode() {
49 return myCode;
50 }
51
52
53
54
55 public String getDisplayName() {
56 return myDisplayName;
57 }
58
59
60
61
62 @Override
63 public int hashCode() {
64 HashCodeBuilder b= new HashCodeBuilder();
65 b.append(myCode);
66 return b.toHashCode();
67 }
68
69
70
71
72 public void setCode(String theCode) {
73 myCode = theCode;
74 if (myTable != null) {
75 myTable.updateCodeIdToCodes();
76 }
77 }
78
79
80
81
82 public void setDisplayName(String theDisplayName) {
83 myDisplayName = theDisplayName;
84 }
85
86
87
88
89 public void setTable(Table theTable) {
90 myTable = theTable;
91 }
92
93
94
95
96 @Override
97 public String toString() {
98 return "Code[code=" + myCode + "]";
99 }
100
101
102 }