private Method getInterfaceMethod(Class<?> clazz, String methodName,
			Class<?>[] parameterTypes) {
		do {
			// Get interfaces
			Class<?>[] interfaces = clazz.getInterfaces();
			for (int i = 0; i < interfaces.length; i++) {
				// Ignore non-public interfaces
				if (!Modifier.isPublic(interfaces[i].getModifiers())) {
					continue;
				}

				// Find method in the current interface
				try {
					return interfaces[i].getDeclaredMethod(methodName,
							parameterTypes);
				} catch (NoSuchMethodException e) {
					// Not found
				}

				// Check superinterfaces
				Method method = getInterfaceMethod(interfaces[i], methodName,
						parameterTypes);
				if (method != null) {
					return method;
				}
			}

			// Check superclass
			clazz = clazz.getSuperclass();
		} while (clazz != null);

		// Not found
		return null;
	}