View Javadoc
1   /*
2    * Copyright 2002-2013 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
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  }