1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.betwixt.dotbetwixt;
17
18 /***
19 * Implementation for example interface
20 *
21 * @author Robert Burrell Donkin
22 */
23 public class ExampleImpl implements IExample {
24
25 private int id;
26 private String name;
27
28 public ExampleImpl() {}
29 public ExampleImpl(int id, String name) {
30 setId(id);
31 setName(name);
32 }
33
34 public int getId() {
35 return id;
36 }
37 public void setId(int id) {
38 this.id = id;
39 }
40
41 public String getName() {
42 return name;
43 }
44
45 public void setName(String name) {
46 this.name = name;
47 }
48
49 public String toString() {
50 return "[" + this.getClass().getName() + ": id=" + id + ", name=" + name + "]";
51 }
52
53 public boolean equals( Object obj ) {
54 if ( obj == null ) return false;
55 return this.hashCode() == obj.hashCode();
56 }
57
58 public int hashCode() {
59 return toString().hashCode();
60 }
61 }
62