1 3 5 7 9 11 13 15 16 17 package org.ozoneDB.core; 18 19 20 21 import org.ozoneDB.DxLib.DxCompatible; 22 23 import org.ozoneDB.DxLib.DxObject; 24 25 26 27 import java.lang.reflect.Method ; 28 29 30 31 32 33 54 55 public final class MethodKey implements Comparable 56 57 { 58 59 protected String methodName; 60 61 62 63 protected String sig; 64 65 66 67 protected String className; 68 69 70 71 protected Method method; 72 73 74 75 76 77 public MethodKey( String _className, String _methodName, String _sig ) { 78 79 this( _className, _methodName, _sig, null ); 80 81 } 82 83 84 85 86 87 public MethodKey( String _className, String _methodName, String _sig, Method _method ) { 88 89 className = _className; 90 91 methodName = _methodName; 92 93 sig = _sig; 94 95 method = _method; 96 97 } 98 99 100 101 102 103 public Method method() { 104 105 return method; 106 107 } 108 109 110 111 112 113 public int hashCode() { 114 115 return methodName.hashCode() ^ sig.hashCode(); 116 117 } 118 119 120 121 122 123 public boolean equals( Object obj ) { 124 125 MethodKey rhs = (MethodKey)obj; 126 127 return className.equals( rhs.className ) && sig.equals( rhs.sig ) && methodName.equals( rhs.methodName ); 128 129 } 130 131 public String toString() { 132 133 134 return className + "." + methodName + "(" + sig + ")"; 135 136 } 137 138 public int compareTo(Object o) { 139 MethodKey rhs = (MethodKey) o; 140 141 142 143 145 147 StringBuffer buf = new StringBuffer ( className ); 148 149 buf.append( methodName ); 150 151 buf.append( sig ); 152 153 154 155 StringBuffer rhsBuf = new StringBuffer ( rhs.className ); 156 157 rhsBuf.append( rhs.methodName ); 158 159 rhsBuf.append( rhs.sig ); 160 161 162 163 return buf.toString().compareTo(rhsBuf.toString()); 164 165 } 166 } | Popular Tags |