比较两个类数组,如果它们相同,则返回true。
/** * Copyright (c) 2011 eXtensible Catalog Organization * * This program is free software; you can redistribute it and/or modify it * under the terms of the MIT/X11 license. The text of the license can be * found at http://www.opensource.org/licenses/mit-license.php. */ /* from 时代Java公众号 - N o w J a v a . c o m*/ import org.apache.log4j.Logger; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Collection; public class Main{ /** * Compare two arrays of classes and return true if they are identical. * @param methodParameterTypes * @param parameterTypes * @return */ public static boolean parametersMatch(Class[] methodParameterTypes, Class[] parameterTypes) { /* 时 代 J a v a - nowjava.com */ boolean parameterTypesMatch = true; if (methodParameterTypes.length == 0 && (parameterTypes == null || parameterTypes.length == 0)) { // Do nothing - parameter types match } else if (parameterTypes != null && parameterTypes.length == methodParameterTypes.length) { for (int i = 0; i < parameterTypes.length; i++) { if (!methodParameterTypes[i]