1public class PersonDTO {
2
3 private String firstName;
4 private String secondName;
5 // Formats output date when this DTO is passed through JSON
6 @JsonFormat(pattern = "dd/MM/yyyy")
7 // Allows dd/MM/yyyy date to be passed into GET request in JSON
8 @DateTimeFormat(pattern = "dd/MM/yyyy")
9 private Date dateOfBirth;
10
11 private String profession;
12 private BigDecimal salary;
13
14 public PersonDTO(
15 String firstName, String secondName, Date dateOfBirth, String profession, BigDecimal salary) {
16 this.firstName = firstName;
17 this.secondName = secondName;
18 this.dateOfBirth = dateOfBirth;
19 this.profession = profession;
20 this.salary = salary;
21 }
22
23 public PersonDTO() {}
24
25 public String getFirstName() {
26 return firstName;
27 }
28
29 public void setFirstName(String firstName) {
30 this.firstName = firstName;
31 }
32
33 public String getSecondName() {
34 return secondName;
35 }
36
37 public void setSecondName(String secondName) {
38 this.secondName = secondName;
39 }
40
41 public Date getDateOfBirth() {
42 return dateOfBirth;
43 }
44
45 public void setDateOfBirth(Date dateOfBirth) {
46 this.dateOfBirth = dateOfBirth;
47 }
48
49 public String getProfession() {
50 return profession;
51 }
52
53 public void setProfession(String profession) {
54 this.profession = profession;
55 }
56
57 public BigDecimal getSalary() {
58 return salary;
59 }
60
61 public void setSalary(BigDecimal salary) {
62 this.salary = salary;
63 }
64}