Examples of unmarshalFromJSON()


Examples of com.sun.jersey.api.json.JSONUnmarshaller.unmarshalFromJSON()

    public void testOnlyEmptyElement() throws Exception {
       
        final JSONJAXBContext ctx = new JSONJAXBContext(JSONConfiguration.mapped().rootUnwrapping(false).build(), EmptyElementBean.class);
        final JSONUnmarshaller ju = ctx.createJSONUnmarshaller();

        EmptyElementBean one = ju.unmarshalFromJSON(new StringReader("{\"emptyElementBean\":{}}"), EmptyElementBean.class);
        EmptyElementBean two = ju.unmarshalFromJSON(new StringReader("{\"emptyElementBean\":null}"), EmptyElementBean.class);

        assertEquals(one, two);
    }
View Full Code Here

Examples of com.sun.jersey.api.json.JSONUnmarshaller.unmarshalFromJSON()

       
        final JSONJAXBContext ctx = new JSONJAXBContext(JSONConfiguration.mapped().rootUnwrapping(false).build(), EmptyElementBean.class);
        final JSONUnmarshaller ju = ctx.createJSONUnmarshaller();

        EmptyElementBean one = ju.unmarshalFromJSON(new StringReader("{\"emptyElementBean\":{}}"), EmptyElementBean.class);
        EmptyElementBean two = ju.unmarshalFromJSON(new StringReader("{\"emptyElementBean\":null}"), EmptyElementBean.class);

        assertEquals(one, two);
    }

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

Examples of com.sun.jersey.api.json.JSONUnmarshaller.unmarshalFromJSON()

        final JSONJAXBContext ctx = new JSONJAXBContext(JSONConfiguration.mapped().rootUnwrapping(false).build(), EmptyElementBean.class, EmptyElementContainingBean.class);
        final JSONUnmarshaller ju = ctx.createJSONUnmarshaller();

        EmptyElementContainingBean one = JSONTestHelper.createTestInstance(EmptyElementContainingBean.class);
        EmptyElementContainingBean two = ju.unmarshalFromJSON(new StringReader("{\"emptyElementContainingBean\":{\"emptyElementBean\":{},\"c\":\"foo\",\"d\":\"bar\"}}"), EmptyElementContainingBean.class);

        assertEquals(one, two);
    }
}
View Full Code Here

Examples of com.sun.jersey.api.json.JSONUnmarshaller.unmarshalFromJSON()

        jm.marshallToJSON(one, sw);

        System.out.println(String.format("%s", sw));

        MyResponse two;
        two =  ju.unmarshalFromJSON(new StringReader(sw.toString()), MyResponse.class);

        assertEquals(one, two);
    }

}
View Full Code Here

Examples of com.sun.jersey.api.json.JSONUnmarshaller.unmarshalFromJSON()

            StringWriter sWriter = new StringWriter();
            marshaller.marshallToJSON(originalBean, sWriter);

            System.out.println(sWriter.toString());
            assertEquals(originalBean, unmarshaller.unmarshalFromJSON(new StringReader(sWriter.toString()), originalBean.getClass()));
        }
    }

    private void printAsXml(Object originalBean) throws JAXBException, PropertyException {
        System.out.println("Checking " + originalBean.toString());
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.