1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.yaml.snakeyaml.recursive;
17
18 import java.util.Date;
19
20 public abstract class AbstractHuman {
21 private String name;
22 private Date birthday;
23 private String birthPlace;
24
25 public String getName() {
26 return name;
27 }
28
29 public void setName(String name) {
30 this.name = name;
31 }
32
33 public Date getBirthday() {
34 return birthday;
35 }
36
37 public void setBirthday(Date birthday) {
38 this.birthday = birthday;
39 }
40
41 public String getBirthPlace() {
42 return birthPlace;
43 }
44
45 public void setBirthPlace(String birthPlace) {
46 this.birthPlace = birthPlace;
47 }
48
49 @Override
50 public int hashCode() {
51 final int prime = 31;
52 int result = 1;
53 result = prime * result + ((birthPlace == null) ? 0 : birthPlace.hashCode());
54 result = prime * result + ((birthday == null) ? 0 : birthday.hashCode());
55 result = prime * result + ((name == null) ? 0 : name.hashCode());
56 return result;
57 }
58
59 @Override
60 public boolean equals(Object obj) {
61 if (this == obj)
62 return true;
63 if (obj == null)
64 return false;
65 if (getClass() != obj.getClass())
66 return false;
67 AbstractHuman other = (AbstractHuman) obj;
68 if (birthPlace == null) {
69 if (other.birthPlace != null)
70 return false;
71 } else if (!birthPlace.equals(other.birthPlace))
72 return false;
73 if (birthday == null) {
74 if (other.birthday != null)
75 return false;
76 } else if (!birthday.equals(other.birthday))
77 return false;
78 if (name == null) {
79 if (other.name != null)
80 return false;
81 } else if (!name.equals(other.name))
82 return false;
83 return true;
84 }
85
86 }