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.issue100;
17
18 public class Data {
19 private String id;
20 private int age;
21
22 public Data() {
23 this.id = null;
24 this.age = 999;
25 }
26
27 public Data(String id, int age) {
28 this.id = id;
29 this.age = age;
30 }
31
32 public String getId() {
33 return id;
34 }
35
36 public void setId(String id) {
37 this.id = id;
38 }
39
40 public int getAge() {
41 return age;
42 }
43
44 public void setAge(int age) {
45 this.age = age;
46 }
47
48 @Override
49 public String toString() {
50 return "Data [age=" + age + ", id=" + id + "]";
51 }
52
53 @Override
54 public boolean equals(Object obj) {
55 if (obj instanceof Data) {
56 return toString().equals(obj.toString());
57 }
58 return false;
59 }
60
61 @Override
62 public int hashCode() {
63 return toString().hashCode();
64 }
65 }