View Javadoc

1   /**
2    * Copyright (c) 2008-2012, http://www.snakeyaml.org
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  package org.yaml.snakeyaml.issues.issue8;
17  
18  import java.io.Serializable;
19  
20  /**
21   * to test http://code.google.com/p/snakeyaml/issues/detail?id=8
22   */
23  public class Person implements Serializable {
24      private static final long serialVersionUID = 1L;
25      private String firstName;
26      private String lastName;
27      private int hatSize;
28  
29      public Person() {
30      }
31  
32      public Person(String firstName, String lastName, int hatSize) {
33          this.firstName = firstName;
34          this.lastName = lastName;
35          this.hatSize = hatSize;
36      }
37  
38      public String getFirstName() {
39          return firstName;
40      }
41  
42      public void setFirstName(String firstName) {
43          this.firstName = firstName;
44      }
45  
46      public String getLastName() {
47          return lastName;
48      }
49  
50      public void setLastName(String lastName) {
51          this.lastName = lastName;
52      }
53  
54      public int getHatSize() {
55          return hatSize;
56      }
57  
58      public void setHatSize(int hatSize) {
59          this.hatSize = hatSize;
60      }
61  
62      @Override
63      public boolean equals(Object object) {
64          if (object instanceof Person) {
65              Person person = (Person) object;
66              return firstName.equals(person.firstName) && lastName.equals(person.lastName)
67                      && hatSize == person.hatSize;
68          }
69          return false;
70      }
71  
72      @Override
73      public int hashCode() {
74          return 1;
75      }
76  }