01: /*
02: * CoadunationLib: The coaduntion implementation library.
03: * Copyright (C) 2006 Rift IT Contracting
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18: *
19: * TestKey.java
20: *
21: * The test key for the proxy test.
22: */
23:
24: package com.rift.coad.lib.bean.test;
25:
26: /**
27: * The test key for the proxy test.
28: *
29: * @author Brett Chaldecott
30: */
31: public class TestKey implements java.io.Serializable {
32:
33: // private member variables
34: private String key1 = null;
35: private String key2 = null;
36:
37: /** Creates a new instance of TestKey */
38: public TestKey() {
39: }
40:
41: /** Creates a new instance of TestKey */
42: public TestKey(String key1, String key2) {
43: this .key1 = key1;
44: this .key2 = key2;
45: }
46:
47: /**
48: * Retrieve the key 1 value.
49: */
50: public String getKey1() {
51: return key1;
52: }
53:
54: /**
55: * This method sets key 1
56: */
57: public void setKey1(String key1) {
58: this .key1 = key1;
59: }
60:
61: /**
62: * Retrieve the key 2 value.
63: */
64: public String getKey2() {
65: return key1;
66: }
67:
68: /**
69: * This method sets key 2
70: */
71: public void setKey2(String key2) {
72: this .key2 = key2;
73: }
74:
75: /**
76: * This method returns the hash code of the test key.
77: */
78: public int hashCode() {
79: return (key1 + key1).hashCode();
80: }
81:
82: /**
83: * This method returns the hash code of the test key.
84: *
85: * @return TRUE if equals, FALSE if not.
86: * @param value The value to perform the test on.
87: */
88: public boolean equals(Object value) {
89: if (!(value instanceof TestKey)) {
90: return false;
91: }
92: TestKey testKey = (TestKey) value;
93: return (key1.equals(testKey.getKey1()) && key2.equals(testKey
94: .getKey2()));
95: }
96: }
|