01: package org.mvel.tests.main.res;
02:
03: public class Cheesery {
04: private String name;
05: private Cheese cheese;
06:
07: public Cheesery(String name) {
08: this (name, null);
09: }
10:
11: public Cheesery(String name, Cheese cheese) {
12: super ();
13: this .name = name;
14: this .cheese = cheese;
15: }
16:
17: public String getName() {
18: return name;
19: }
20:
21: public void setName(String name) {
22: this .name = name;
23: }
24:
25: public Cheese getCheese() {
26: return cheese;
27: }
28:
29: public void setCheese(Cheese cheese) {
30: this .cheese = cheese;
31: }
32:
33: @Override
34: public int hashCode() {
35: final int prime = 31;
36: int result = 1;
37: result = prime * result
38: + ((cheese == null) ? 0 : cheese.hashCode());
39: result = prime * result
40: + ((name == null) ? 0 : name.hashCode());
41: return result;
42: }
43:
44: @Override
45: public boolean equals(Object obj) {
46: if (this == obj)
47: return true;
48: if (obj == null)
49: return false;
50: if (getClass() != obj.getClass())
51: return false;
52: final Cheesery other = (Cheesery) obj;
53: if (cheese == null) {
54: if (other.cheese != null)
55: return false;
56: } else if (!cheese.equals(other.cheese))
57: return false;
58: if (name == null) {
59: if (other.name != null)
60: return false;
61: } else if (!name.equals(other.name))
62: return false;
63: return true;
64: }
65:
66: }
|