1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.test.web;
18
19 import javax.validation.constraints.NotNull;
20 import javax.xml.bind.annotation.XmlRootElement;
21
22 import org.springframework.util.ObjectUtils;
23
24 @XmlRootElement
25 public class Person {
26
27 @NotNull
28 private String name;
29
30 private double someDouble;
31
32 private boolean someBoolean;
33
34 public Person() {
35 }
36
37 public Person(String name) {
38 this.name = name;
39 }
40
41 public String getName() {
42 return name;
43 }
44
45 public Person setName(String name) {
46 this.name = name;
47 return this;
48 }
49
50 public double getSomeDouble() {
51 return someDouble;
52 }
53
54 public Person setSomeDouble(double someDouble) {
55 this.someDouble = someDouble;
56 return this;
57 }
58
59 public boolean isSomeBoolean() {
60 return someBoolean;
61 }
62
63 public Person setSomeBoolean(boolean someBoolean) {
64 this.someBoolean = someBoolean;
65 return this;
66 }
67
68 @Override
69 public boolean equals(Object other) {
70 if (this == other) {
71 return true;
72 }
73 if (!(other instanceof Person)) {
74 return false;
75 }
76 Person otherPerson = (Person) other;
77 return (ObjectUtils.nullSafeEquals(this.name, otherPerson.name) &&
78 ObjectUtils.nullSafeEquals(this.someDouble, otherPerson.someDouble) &&
79 ObjectUtils.nullSafeEquals(this.someBoolean, otherPerson.someBoolean));
80 }
81
82 @Override
83 public int hashCode() {
84 return Person.class.hashCode();
85 }
86
87 @Override
88 public String toString() {
89 return "Person [name=" + this.name + ", someDouble=" + this.someDouble
90 + ", someBoolean=" + this.someBoolean + "]";
91 }
92
93 }