/** true iff all args match the corresponding types */ public static boolean typesMatch(Object[] argsArray, Class<?>[] parameterTypes, Optional<? extends TypeCoercer> coercer) { if (argsArray.length != parameterTypes.length) return false; return typesMatchUpTo(argsArray, parameterTypes, argsArray.length, coercer); }
/** true iff the initial N args match the corresponding types */ public static boolean typesMatchUpTo(Object[] argsArray, Class<?>[] parameterTypes, int lengthRequired) { return typesMatchUpTo(argsArray, parameterTypes, lengthRequired, Optional.<TypeCoercer>absent()); }
Class<?>[] parameterTypes = m.getParameterTypes(); if (m.isVarArgs()) { if (typesMatchUpTo(argsArray, parameterTypes, parameterTypes.length-1, coercer)) { Class<?> varargType = parameterTypes[parameterTypes.length-1].getComponentType(); boolean varargsMatch = true;
Class<?>[] parameterTypes = constructor.getParameterTypes(); if (constructor.isVarArgs()) { if (typesMatchUpTo(argsArray, parameterTypes, parameterTypes.length-1)) { Class<?> varargType = parameterTypes[parameterTypes.length-1].getComponentType(); boolean varargsMatch = true;