Boxing extends BoxingBase { public static <T> T as(Object src, Class<T> type) { Class<?> t = type; while (t.isArray()) { t = t.getComponentType(); } if (t == type) { return boxAs(src, type); } else { if (t.isPrimitive()) { return deepUnboxAs(src, type); } else { return deepBoxAs(src, type); } } }  static Class<?> boxingType(Class<?> clazz); static Class<?> box(Class<?> type); static Class<?> primitive(Class<?> clazz); static Map<Class<?>, Class<?>> boxingTypes(); static Map<Class<?>, Class<?>> boxes(); static Map<Class<?>, Class<?>> primitives(); static Object unbox(Class<?> clazz, Object src); static T unboxAs(Object src, Class<T> clazz); static Object unboxAll(Class<?> type, Object[] src, int srcPos, int len); static Object unboxAll(Class<?> type, Object[] src); static Object unboxAll(Object[] src, int srcPos, int len); static Object unboxAll(Object[] src); static Object unboxAll(Class<?> type, Object src, int srcPos, int len); static Object unboxAll(Class<?> type, Object src); static T unboxAllAs(Object src, int srcPos, int len, Class<T> type); static T unboxAllAs(Object src, Class<T> type); static boolean[] unboxBooleans(Object src, int srcPos, int len); static byte[] unboxBytes(Object src, int srcPos, int len); static char[] unboxCharacters(Object src, int srcPos, int len); static float[] unboxFloats(Object src, int srcPos, int len); static double[] unboxDoubles(Object src, int srcPos, int len); static int[] unboxIntegers(Object src, int srcPos, int len); static long[] unboxLongs(Object src, int srcPos, int len); static short[] unboxShorts(Object src, int srcPos, int len); static boolean[] unboxBooleans(Object src); static byte[] unboxBytes(Object src); static char[] unboxCharacters(Object src); static float[] unboxFloats(Object src); static double[] unboxDoubles(Object src); static int[] unboxIntegers(Object src); static long[] unboxLongs(Object src); static short[] unboxShorts(Object src); static Object box(Class<?> type, Object src); static T boxAs(Object src, Class<T> type); static Object[] boxAll(Object src, int srcPos, int len); static Object[] boxAll(Object src); static Object[] boxAll(Class<?> type, Object src, int srcPos, int len); static Object[] boxAll(Class<?> type, Object src); static T boxAllAs(Object src, int srcPos, int len, Class<T> type); static T boxAllAs(Object src, Class<T> type); static Boolean[] boxBooleans(Object src, int srcPos, int len); static Byte[] boxBytes(Object src, int srcPos, int len); static Character[] boxCharacters(Object src, int srcPos, int len); static Float[] boxFloats(Object src, int srcPos, int len); static Double[] boxDoubles(Object src, int srcPos, int len); static Integer[] boxIntegers(Object src, int srcPos, int len); static Long[] boxLongs(Object src, int srcPos, int len); static Short[] boxShorts(Object src, int srcPos, int len); static Boolean[] boxBooleans(Object src); static Byte[] boxBytes(Object src); static Character[] boxCharacters(Object src); static Float[] boxFloats(Object src); static Double[] boxDoubles(Object src); static Integer[] boxIntegers(Object src); static Long[] boxLongs(Object src); static Short[] boxShorts(Object src); static Object deepUnbox(Object[] src); static Object deepUnbox(Class<?> type, final Object src); static T deepUnboxAs(Object src, Class<T> result); static Object deepBox(Object src); static Object[] deepBox(Class<?> resultType, final Object src); static T deepBoxAs(Object src, Class<T> type); static T as(Object src, Class<T> type); static Array array(Object array);  }
@Test public void test_as() { Object[][] data = {{1L, 2.0}, {true, ' '}}; int[][] result = Boxing.as(data, int[][].class); assertThat(result[0], is(new int[]{1, 2})); assertThat(result[1], is(new int[]{1, 32})); }