Examples of unmarshalFromJSON()


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

        final JSONUnmarshaller ju = ctx.createJSONUnmarshaller();
        StringWriter sw = new StringWriter();
        jm.marshallToJSON(one, sw);
        System.out.println(String.format("Marshalled: %s", sw));

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

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

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

        final SimpleBeanWithAttributes one = JSONTestHelper.createTestInstance(SimpleBeanWithAttributes.class);
        jm.marshallToJSON(one, sw);
        System.out.println(sw.toString());
       
        SimpleBeanWithAttributes unmarshalledOne = ju.unmarshalFromJSON(new StringReader(sw.toString()), SimpleBeanWithAttributes.class);

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

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\":{\"nullOnly\":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\":{\"nullOnly\":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()

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

        MyResponse two;
        two =  ju.unmarshalFromJSON(new StringReader(s), 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());
            final Object actual = unmarshaller.unmarshalFromJSON(new StringReader(sWriter.toString()), beanClass);

            if (useDefaultConfiguration) {
                // let know the bean that the old approach (instance with empty properties -> 'null') is being tested so it should
                // handle the equals method a little bit different
                try {
View Full Code Here

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

        AnimalList two;
        jm.marshallToJSON(one, sw);

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

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

        assertEquals(one, two);
        for (int i = 0; i < one.animals.size(); i++) {
            assertEquals(one.animals.get(i).getClass(), two.animals.get(i).getClass());
        }
View Full Code Here

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

            jm.marshallToJSON(animalOne, sw);

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

            animalTwo = ju.unmarshalFromJSON(new StringReader(sw.toString()), Animal.class);

            assertEquals(animalOne, animalTwo);
            System.out.println(String.format("class one = %s; class two = %s", animalOne.getClass(), animalTwo.getClass()));
            assertEquals(animalOne.getClass(), animalTwo.getClass());
        }
View Full Code Here

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

        RegisterMessage two;
        jm.marshallToJSON(one, sw);

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

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

        assertEquals(one, two);
    }

}
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.