01: ///////////////////////////////////////////////////////////////////////////////
02: //
03: // Copyright (C) 2003-@year@ by Thomas M. Hazel, MyOODB (www.myoodb.org)
04: //
05: // All Rights Reserved
06: //
07: // This program is free software; you can redistribute it and/or modify
08: // it under the terms of the GNU General Public License and GNU Library
09: // General Public License as published by the Free Software Foundation;
10: // either version 2, or (at your option) any later version.
11: //
12: // This program is distributed in the hope that it will be useful,
13: // but WITHOUT ANY WARRANTY; without even the implied warranty of
14: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: // GNU General Public License and GNU Library General Public License
16: // for more details.
17: //
18: // You should have received a copy of the GNU General Public License
19: // and GNU Library General Public License along with this program; if
20: // not, write to the Free Software Foundation, 675 Mass Ave, Cambridge,
21: // MA 02139, USA.
22: //
23: ///////////////////////////////////////////////////////////////////////////////
24: package org.myoodb.core;
25:
26: import java.lang.reflect.Method;
27:
28: public final class MethodSignature implements Comparable {
29: private String m_signature;
30: private Method m_method;
31:
32: public MethodSignature(String className, String methodName,
33: String args) {
34: this (className, methodName, args, null);
35: }
36:
37: public MethodSignature(String className, String methodName,
38: String args, Method method) {
39: m_signature = new String(className + "." + methodName + "("
40: + args + ")");
41: m_method = method;
42: }
43:
44: public Method getMethod() {
45: return m_method;
46: }
47:
48: public int hashCode() {
49: return m_signature.hashCode();
50: }
51:
52: public boolean equals(Object obj) {
53: MethodSignature rhs = (MethodSignature) obj;
54: return m_signature.equals(rhs.m_signature);
55: }
56:
57: public int compareTo(Object o) {
58: MethodSignature rhs = (MethodSignature) o;
59: return m_signature.compareTo(rhs.m_signature);
60: }
61:
62: public String toString() {
63: return m_signature;
64: }
65: }
|