blob: b99a898366d441df962fff95fd276276f4fa282d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*
* See LICENSE file in distribution for copyright and licensing information.
*/
package org.yaml.snakeyaml.constructor;
public class MyWheel {
private int id;
private String brand;
public MyWheel() {
brand = "Pirelli";
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Override
public String toString() {
return "Wheel id=" + id;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof MyWheel) {
MyWheel wheel = (MyWheel) obj;
return id == wheel.getId();
} else {
return false;
}
}
@Override
public int hashCode() {
return new Integer(id).hashCode();
}
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand = brand;
}
}
|