1 | public class Employee {↵ | | 1 | public class PersonalDetails {↵
|
| | | 2 | private Long id;
↵
|
2 | private String personName;↵ | | 3 | private String somePersonalDetail;
↵
|
3 | private Person person;↵ | | 4 | private Person person;↵
|
4 | private Collection employments = new ArrayList(); ↵ | | |
|
5 | Employee() {}↵ | | |
|
6 | public Employee(↵ | | |
|
|
| | | 5 | public PersonalDetails() {↵
|
| | | 6 | }↵
|
|
7 | Person p) {↵ | | 7 | public PersonalDetails(String somePersonalDetail, Person person) {
↵
|
8 | this.person = p;↵ | | 8 | this.somePersonalDetail = somePersonalDetail;
↵
|
9 | this.personName = p.getName();↵ | | 9 | this.person↵
|
10 | p.setEmployee(↵ | | 10 | = person;↵
|
11 | this);↵ | | 11 | person.setDetails( this );
↵
|
12 | }↵ | | 12 | }↵
|
| | | 13 |
↵
|
13 | public Person getPerson() {↵ | | 14 | public Long getId() {
↵
|
14 | return person;↵ | | 15 | return ↵
|
15 | }↵ | | 16 | id;↵
|
| | | 17 | }↵
|
| | | 18 |
↵
|
16 | public void setPerson(Person person) {↵ | | 19 | public void setId(Long id) {
↵
|
17 | this.person = person;↵ | | 20 | this.↵
|
18 | }↵ | | 21 | id = id;↵
|
| | | 22 | }↵
|
| | | 23 |
↵
|
19 | public String getPersonName() {↵ | | 24 | public String getSomePersonalDetail() {
↵
|
20 | return personName;↵ | | 25 | return ↵
|
21 | }↵ | | 26 | somePersonalDetail;↵
|
| | | 27 | }↵
|
| | | 28 |
↵
|
22 | public void setPersonName(String personName) {↵ | | 29 | public void setSomePersonalDetail(String somePersonalDetail) {
↵
|
23 | this.personName = personName;↵ | | 30 | this.↵
|
24 | }↵ | | 31 | somePersonalDetail = somePersonalDetail;↵
|
| | | 32 | }↵
|
| | | 33 |
↵
|
25 | public Collection getEmployments() {↵ | | 34 | public Person getPerson() {
↵
|
26 | return employments;↵ | | 35 | return ↵
|
27 | }↵ | | 36 | person;↵
|
| | | 37 | }↵
|
| | | 38 |
↵
|
28 | public void setEmployments(Collection employments) {↵ | | 39 | public void setPerson(Person person) {
↵
|
29 | this.employments = employments;↵ | | 40 | this.person = person;
↵
|
30 | | | 41 |
|