/** * Copy constructor. * * @param orig Copy to create this instance from. * @param newParams Optional array of new parameters to override the ondes from {@code orig}. */ public GridifyArgumentAdapter(GridifyArgument orig, Object... newParams) { A.notNull(orig, "orig"); cls = orig.getMethodClass(); mtdName = orig.getMethodName(); target = orig.getTarget(); types = new Class[orig.getMethodParameterTypes().length]; params = new Object[orig.getMethodParameters().length]; System.arraycopy(orig.getMethodParameters(), 0, params, 0, params.length); System.arraycopy(orig.getMethodParameterTypes(), 0, types, 0, types.length); // Override parameters, if any. if (newParams.length > 0) { setMethodParameters(newParams); } }