Package com.fasterxml.jackson.dataformat.xml

Examples of com.fasterxml.jackson.dataformat.xml.XmlMapper.convertValue()


        verifyIntArrayConversion(mapper, data, short[].class);
        verifyIntArrayConversion(mapper, data, long[].class);

        List<Number> expNums = _numberList(data, data.length);
        // Alas, due to type erasure, need to use TypeRef, not just class
        List<Integer> actNums = mapper.convertValue(data, new TypeReference<List<Integer>>() {});
        assertEquals(expNums, actNums);
    }

    public void testLongArrayToX() throws Exception
    {
View Full Code Here


        verifyLongArrayConversion(mapper, data, byte[].class);
        verifyLongArrayConversion(mapper, data, short[].class);
        verifyLongArrayConversion(mapper, data, int[].class);
        List<Number> expNums = _numberList(data, data.length);
        List<Long> actNums = mapper.convertValue(data, new TypeReference<List<Long>>() {});
        assertEquals(expNums, actNums);       
    }

    public void testListToIntArray() throws Exception
    {
View Full Code Here

        final XmlMapper mapper = xmlMapper(wrap);
        List<Integer> in = new ArrayList<Integer>();
        in.add(1);
        in.add(2);
        in.add(3);
        int[] out = mapper.convertValue(in, int[].class);
        assertEquals(3, out.length);
        for (int i = 0; i < out.length; ++i) {
            assertEquals(i+1, out[i]);
        }
    }
View Full Code Here

    }

    private void _testListAsProperty(boolean wrap) throws Exception
    {
        final XmlMapper mapper = xmlMapper(wrap);
        IntListWrapper mid = mapper.convertValue(new IntArrayWrapper(new int[] { 1, 2, 3}),
                IntListWrapper.class);
        assertNotNull(mid);
        assertNotNull(mid.values);
        assertEquals(3, mid.values.size());
View Full Code Here

                IntListWrapper.class);
        assertNotNull(mid);
        assertNotNull(mid.values);
        assertEquals(3, mid.values.size());

        IntArrayWrapper output = mapper.convertValue(mid, IntArrayWrapper.class);
        assertEquals(3, output.values.length);
        assertEquals(3, output.values[2]);
    }
   
    /*
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.