01: /*
02: * This file is part of DrFTPD, Distributed FTP Daemon.
03: *
04: * DrFTPD is free software; you can redistribute it and/or modify
05: * it under the terms of the GNU General Public License as published by
06: * the Free Software Foundation; either version 2 of the License, or
07: * (at your option) any later version.
08: *
09: * DrFTPD is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13: *
14: * You should have received a copy of the GNU General Public License
15: * along with DrFTPD; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18: package org.drftpd.dynamicdata;
19:
20: import java.io.Serializable;
21:
22: /**
23: * @author mog
24: * @version $Id: Key.java 1513 2006-10-13 22:41:08Z tdsoul $
25: */
26: public class Key implements Serializable {
27: private String _key;
28: private Class _owner;
29: private Class _type;
30:
31: public Key(Class owner, String key, Class type) {
32: assert owner != null;
33: assert key != null;
34: assert type != null;
35: _owner = owner;
36: _key = key;
37: _type = type;
38: }
39:
40: public boolean equals(Object o) {
41: if (o == null) {
42: return false;
43: }
44:
45: Key ok = (Key) o;
46:
47: return ok.getOwner() == getOwner()
48: && ok.getKey().equals(getKey());
49: }
50:
51: public String getKey() {
52: return _key;
53: }
54:
55: public Class getOwner() {
56: return _owner;
57: }
58:
59: public Class getType() {
60: return _type;
61: }
62:
63: public String toString() {
64: return getOwner().getName() + '@' + getKey();
65: }
66:
67: public String toString(Object value) {
68: return value.toString();
69: }
70:
71: public int hashCode() {
72: return toString().hashCode();
73: }
74: }
|