@SuppressWarnings("unchecked") @Test public void shouldMapNestedList() { final ArrayNode<IJsonNode> input = new ArrayNode<IJsonNode>().add(new ArrayNode<IJsonNode>().add(new TextNode("field1")).add(new IntNode(1))) .add(new ArrayNode<IJsonNode>().add(new TextNode("field2")).add(new IntNode(2))); final List<Object[]> expected = Arrays.asList(new Object[] { "field1", 1 }, new Object[] { "field2", 2 }); final Object actual = this.mapper.map(input, null, new TypeToken<List<Object[]>>() { }.getType()); Assert.assertTrue(actual instanceof List); Assert.assertEquals(2, ((List<Object>) actual).size()); Assert.assertArrayEquals(expected.get(0), ((List<Object[]>) actual).get(0)); Assert.assertArrayEquals(expected.get(1), ((List<Object[]>) actual).get(1)); final List<List<Object>> expected2 = Arrays.asList(Arrays.<Object> asList("field1", 1), Arrays.<Object> asList("field2", 2)); Assert.assertEquals(expected2, this.mapper.map(input, null, new TypeToken<List<List<Object>>>() { }.getType())); Assert.assertEquals(expected2, this.mapper.map(input)); }
public <T> T map(final IJsonNode from) { return this.map(from, null, this.getDefaultMappingType(from.getClass())); }
JsonToJavaMapper extends AbstractTypeMapper<TypeMapper<?, ?>> { public <T> T map(final IJsonNode from) { return this.map(from, null, this.getDefaultMappingType(from.getClass())); } }
JsonToJavaMapper extends AbstractTypeMapper<TypeMapper<?, ?>> { public <T> T map(final IJsonNode from) { return this.map(from, null, this.getDefaultMappingType(from.getClass())); } protected  JsonToJavaMapper(); }
JsonToJavaMapper extends AbstractTypeMapper<TypeMapper<?, ?>> { public <T> T map(final IJsonNode from) { return this.map(from, null, this.getDefaultMappingType(from.getClass())); } protected  JsonToJavaMapper(); @SuppressWarnings("unchecked") TypeMapper<F, T> getMapper(final Class<F> fromClass, final Class<T> targetType); T map(final IJsonNode from); T map(final IJsonNode from, final T to); T map(final IJsonNode from, final T to, final Class<T> targetType); T map(final IJsonNode from, T to, final Type targetType); }
JsonToJavaMapper extends AbstractTypeMapper<TypeMapper<?, ?>> { public <T> T map(final IJsonNode from) { return this.map(from, null, this.getDefaultMappingType(from.getClass())); } protected  JsonToJavaMapper(); @SuppressWarnings("unchecked") TypeMapper<F, T> getMapper(final Class<F> fromClass, final Class<T> targetType); T map(final IJsonNode from); T map(final IJsonNode from, final T to); T map(final IJsonNode from, final T to, final Class<T> targetType); T map(final IJsonNode from, T to, final Type targetType); static final JsonToJavaMapper INSTANCE; }