DefaultMultiValue implements MultiValue { @Override public Object[] unwrap() { Object[] result = new Object[values.length]; for (int i = 0; i < values.length; i++) { Object val = values[i]; if (val instanceof ValueHolder) { ValueHolder cell = (ValueHolder) val; result[i] = cell.getValue(); } if (val instanceof ValueHolder[]) { ValueHolder[] cell = (ValueHolder[]) val; Object[] array = new Object[cell.length]; for (int j = 0; j < cell.length; j++) { array[j] = cell[j].getValue(); } result[i] = array; } } return result; } DefaultMultiValue(Object[] values);  DefaultMultiValue(Object[] values, Map<String, Integer> indexMap);  DefaultMultiValue(ParameterEntryKey key, Object[] values, Map<String, Integer> indexMap); @Override ParameterEntryKey getKey(); @Override ValueHolder getHolder(int position); @SuppressWarnings("unchecked") @Override T get(int position); @Override T get(int position, Class<T> clazz); @Override String getString(int position); @Override BigDecimal getBigDecimal(int position); @Override Date getDate(int position); @Override Integer getInteger(int position); @Override Long getLong(int position); @Override Boolean getBoolean(int position); @Override ValueHolder getHolder(String name); @SuppressWarnings("unchecked") @Override T get(String name); @Override T get(String name, Class<T> clazz); @Override String getString(String name); @Override BigDecimal getBigDecimal(String name); @Override Date getDate(String name); @Override Integer getInteger(String name); @Override Long getLong(String name); @Override Boolean getBoolean(String name); @Override T getEnum(int position, Class<T> enumClass); @Override T getEnum(String name, Class<T> enumClass); @Override ValueHolder[] getArray(int position); @Override Object[] unwrap(); @Override String[] getStringArray(int position); @Override Date[] getDateArray(int position); @Override Integer[] getIntegerArray(int position); @Override Long[] getLongArray(int position); @Override Boolean[] getBooleanArray(int position); @Override BigDecimal[] getBigDecimalArray(int position); @Override ValueHolder[] getArray(String name); @Override String[] getStringArray(String name); @Override BigDecimal[] getBigDecimalArray(String name); @Override Date[] getDateArray(String name); @Override Integer[] getIntegerArray(String name); @Override Long[] getLongArray(String name); @Override Boolean[] getBooleanArray(String name); @Override String[] asStrings(); @Override BigDecimal[] asBigDecimals(); @Override String toString(); @Override String toStringInline(); @Override ValueHolder nextHolder(); @SuppressWarnings("unchecked") @Override T next(); @Override T next(Class<T> clazz); @Override String nextString(); @Override BigDecimal nextBigDecimal(); @Override Date nextDate(); @Override Integer nextInteger(); @Override Long nextLong(); @Override T nextEnum(Class<T> enumClass); @Override ValueHolder[] nextArray(); @Override String[] nextStringArray(); @Override BigDecimal[] nextBigDecimalArray(); @Override Date[] nextDateArray(); @Override Integer[] nextIntegerArray(); @Override Long[] nextLongArray(); @Override int size();  }
@Test public void testUnwrap() { Date date = new Date(); ValueHolder h1 = new StringHolder("a"); ValueHolder h2 = new NumberHolder(BigDecimal.ONE); ValueHolder h3 = new IntegerHolder(100L); ValueHolder h4 = new DateHolder(date); Object element1 = h1; Object element2 = new ValueHolder[]{h2, h3}; Object element3 = h4; MultiValue mv = new DefaultMultiValue(new Object[]{element1, element2, element3}); Object[] unwrapped = mv.unwrap(); Object[] expectedResult = { "a", new Object[]{BigDecimal.ONE, 100L}, date }; assertArrayEquals(expectedResult, unwrapped); }