private boolean mismatch(Class[] a1, Class[] a2) { int a1Count = count(a1); int a2Count = count(a2); if (a1Count != a2Count) return true; // Hm. What if order is important (for exceptions)? We're really saying here that they // were derived from the name Method. for (int i = 0; i < a1Count; i++) { if (a1[i] != a2[i]) return true; } return false; }
public int hashCode() { if (_hashCode == -1) { _hashCode = _returnType.hashCode(); _hashCode = 31 * _hashCode + _name.hashCode(); int count = count(_parameterTypes); for (int i = 0; i < count; i++) _hashCode = 31 * _hashCode + _parameterTypes[i].hashCode(); count = count(_exceptionTypes); for (int i = 0; i < count; i++) _hashCode = 31 * _hashCode + _exceptionTypes[i].hashCode(); } return _hashCode; }
/** * Returns a string consisting of the name of the method and its parameter values. This is * similar to {@link #toString()}, but omits the return type and information about thrown * exceptions. A unique id is used by {@link MethodIterator} to identify overlapping methods * (methods with the same name but different thrown exceptions). * * @since 1.1 */ public String getUniqueId() { StringBuffer buffer = new StringBuffer(_name); buffer.append("("); for (int i = 0; i < count(_parameterTypes); i++) { if (i > 0) buffer.append(","); buffer.append(ClassFabUtils.getJavaClassName(_parameterTypes[i])); } buffer.append(")"); return buffer.toString(); }
public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(ClassFabUtils.getJavaClassName(_returnType)); buffer.append(" "); buffer.append(_name); buffer.append("("); for (int i = 0; i < count(_parameterTypes); i++) { if (i > 0) buffer.append(", "); buffer.append(ClassFabUtils.getJavaClassName(_parameterTypes[i])); } buffer.append(")"); for (int i = 0; i < count(_exceptionTypes); i++) { if (i == 0) buffer.append(" throws "); else buffer.append(", "); buffer.append(_exceptionTypes[i].getName()); } return buffer.toString(); }