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