Package org.apache.pivot.json

Examples of org.apache.pivot.json.JSONSerializer.readObject()


        jsonSerializer.getJSONSerializerListeners().add(jsonSerializerListener);
        Object o1 = jsonSerializer.readObject(getClass().getResourceAsStream("map.json"));
        assertEquals(JSON.get(o1, "count"), 8);

        jsonSerializer.getJSONSerializerListeners().remove(jsonSerializerListener);
        Object o2 = jsonSerializer.readObject(getClass().getResourceAsStream("map.json"));

        assertTrue(o1.equals(o2));

        List<?> d = JSON.get(o1, "d");
        d.remove(0, 1);
View Full Code Here


        }

        JSONSerializer jsonSerializer = new JSONSerializer();

        try {
            setListData((List<?>)jsonSerializer.readObject(listData.openStream()));
        } catch (SerializationException exception) {
            throw new IllegalArgumentException(exception);
        } catch (IOException exception) {
            throw new IllegalArgumentException(exception);
        }
View Full Code Here

        try {
            InputStream inputStream = stylesheetLocation.openStream();

            try {
                JSONSerializer serializer = new JSONSerializer();
                Map<String, ?> stylesheet = (Map<String, ?>)serializer.readObject(inputStream);

                for (String name : stylesheet) {
                    Map<String, ?> styles = (Map<String, ?>)stylesheet.get(name);

                    int i = name.lastIndexOf('.') + 1;
View Full Code Here

        }

        JSONSerializer jsonSerializer = new JSONSerializer();

        try {
            setTableData((List<?>)jsonSerializer.readObject(tableData.openStream()));
        } catch (SerializationException exception) {
            throw new IllegalArgumentException(exception);
        } catch (IOException exception) {
            throw new IllegalArgumentException(exception);
        }
View Full Code Here

        }

        JSONSerializer jsonSerializer = new JSONSerializer();

        try {
            setListData((List<?>)jsonSerializer.readObject(listData.openStream()));
        } catch (SerializationException exception) {
            throw new IllegalArgumentException(exception);
        } catch (IOException exception) {
            throw new IllegalArgumentException(exception);
        }
View Full Code Here

        }

        Object value;
        try {
            JSONSerializer jsonSerializer = new JSONSerializer();
            value = jsonSerializer.readObject(new FileInputStream(file));
        } catch (IOException exception) {
            throw new QueryException(Query.Status.INTERNAL_SERVER_ERROR);
        } catch (SerializationException exception) {
            throw new QueryException(Query.Status.INTERNAL_SERVER_ERROR);
        }
View Full Code Here

        }

        JSONSerializer jsonSerializer = new JSONSerializer();

        try {
            setListData((List<?>)jsonSerializer.readObject(listData.openStream()));
        } catch (SerializationException exception) {
            throw new IllegalArgumentException(exception);
        } catch (IOException exception) {
            throw new IllegalArgumentException(exception);
        }
View Full Code Here

        }

        JSONSerializer jsonSerializer = new JSONSerializer();

        try {
            setListData((List<?>)jsonSerializer.readObject(listData.openStream()));
        } catch (SerializationException exception) {
            throw new IllegalArgumentException(exception);
        } catch (IOException exception) {
            throw new IllegalArgumentException(exception);
        }
View Full Code Here

            (Map<String, Object>)ApplicationContext.getResourceCache().get(styles);

        if (cachedStyles == null) {
            JSONSerializer jsonSerializer = new JSONSerializer();
            cachedStyles =
                (Map<String, Object>)jsonSerializer.readObject(styles.openStream());

            ApplicationContext.getResourceCache().put(styles, cachedStyles);
        }

        setStyles(cachedStyles);
View Full Code Here

    }

    @Test
    public void testEquals() throws IOException, SerializationException {
        JSONSerializer jsonSerializer = new JSONSerializer();
        Object o1 = jsonSerializer.readObject(getClass().getResourceAsStream("sample.json"));
        Object o2 = jsonSerializer.readObject(getClass().getResourceAsStream("sample.json"));

        assertTrue(o1.equals(o2));

        List<?> d = JSON.getList(o1, "d");
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.