1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.commons.ihe.xds.core.metadata;
17
18 import ca.uhn.hl7v2.model.Composite;
19 import org.openehealth.ipf.commons.ihe.xds.core.metadata.jaxbadapters.NameAdapter;
20
21 import javax.xml.bind.annotation.XmlAccessType;
22 import javax.xml.bind.annotation.XmlAccessorType;
23 import javax.xml.bind.annotation.XmlElement;
24 import javax.xml.bind.annotation.XmlType;
25 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
26 import java.util.Objects;
27
28
29
30
31
32
33
34
35
36
37
38
39
40 @XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
41 @XmlJavaTypeAdapter(value = NameAdapter.class)
42 @XmlType(name = "Name", propOrder = {"prefix", "givenName", "secondAndFurtherGivenNames",
43 "familyName", "suffix", "degree"})
44 public abstract class Name<T extends Composite> extends Hl7v2Based<T> {
45 private static final long serialVersionUID = -3455779057944896901L;
46
47 protected Name() {
48 }
49
50 protected Name(T hapiObject) {
51 super(hapiObject);
52 }
53
54
55 @XmlElement(name = "family")
56 abstract public String getFamilyName();
57 @XmlElement(name = "given")
58 abstract public String getGivenName();
59 @XmlElement(name = "secondAndFurtherGiven")
60 abstract public String getSecondAndFurtherGivenNames();
61 abstract public String getSuffix();
62 abstract public String getPrefix();
63 abstract public String getDegree();
64
65 abstract public void setFamilyName(String value);
66 abstract public void setGivenName(String value);
67 abstract public void setSecondAndFurtherGivenNames(String value);
68 abstract public void setSuffix(String value);
69 abstract public void setPrefix(String value);
70 abstract public void setDegree(String value);
71
72
73 @Override
74 public boolean equals(Object o) {
75 if (this == o) return true;
76 if (o == null || !(o instanceof Name)) return false;
77 Name<?> that = (Name<?>) o;
78 return Objects.equals(getFamilyName(), that.getFamilyName()) &&
79 Objects.equals(getGivenName(), that.getGivenName()) &&
80 Objects.equals(getSecondAndFurtherGivenNames(), that.getSecondAndFurtherGivenNames()) &&
81 Objects.equals(getSuffix(), that.getSuffix()) &&
82 Objects.equals(getPrefix(), that.getPrefix()) &&
83 Objects.equals(getDegree(), that.getDegree());
84 }
85
86 @Override
87 public int hashCode() {
88 return Objects.hash(getFamilyName(), getGivenName(), getSecondAndFurtherGivenNames(),
89 getSuffix(), getPrefix(), getDegree());
90 }
91
92 @Override
93 public String toString() {
94 return "Name(" +
95 "familyName=" + getFamilyName() +
96 ", givenName=" + getGivenName() +
97 ", secondAndFurtherGivenNames=" + getSecondAndFurtherGivenNames() +
98 ", suffix=" + getSuffix() +
99 ", prefix=" + getPrefix() +
100 ", degree=" + getDegree() +
101 ')';
102 }
103 }