Package org.codehaus.jettison.json

Examples of org.codehaus.jettison.json.JSONTokener


    @Test
    public void edgeFromJsonNormalLabelOrIdOnEdge() throws IOException, JSONException {
        Graph g = new TinkerGraph();
        ElementFactory factory = new GraphElementFactory(g);

        Vertex v1 = GraphSONUtility.vertexFromJson(new JSONObject(new JSONTokener(vertexJson1)), factory, GraphSONMode.NORMAL, null);
        Vertex v2 = GraphSONUtility.vertexFromJson(new JSONObject(new JSONTokener(vertexJson2)), factory, GraphSONMode.NORMAL, null);
        Edge e = GraphSONUtility.edgeFromJson(new JSONObject(new JSONTokener(edgeJsonLight)), v1, v2, factory, GraphSONMode.NORMAL, null);

        Assert.assertSame(v1, g.getVertex(1));
        Assert.assertSame(v2, g.getVertex(2));
        Assert.assertSame(e, g.getEdge(0));
    }
View Full Code Here


    @Test
    public void edgeFromJsonInputStreamCompactLabelOrIdOnEdge() throws IOException, JSONException {
        Graph g = new TinkerGraph();
        ElementFactory factory = new GraphElementFactory(g);

        Vertex v1 = GraphSONUtility.vertexFromJson(new JSONObject(new JSONTokener(vertexJson1)), factory, GraphSONMode.COMPACT, null);
        Vertex v2 = GraphSONUtility.vertexFromJson(new JSONObject(new JSONTokener(vertexJson2)), factory, GraphSONMode.COMPACT, null);
        Edge e = GraphSONUtility.edgeFromJson(inputStreamEdgeJsonLight, v1, v2, factory, GraphSONMode.COMPACT, null);

        Assert.assertSame(v1, g.getVertex(1));
        Assert.assertSame(v2, g.getVertex(2));
        Assert.assertSame(e, g.getEdge(0));
View Full Code Here

            add(GraphSONTokens._IN_V);
        }};

        GraphSONUtility graphson = new GraphSONUtility(GraphSONMode.COMPACT, factory, vertexKeys, edgeKeys);

        Vertex v1 = graphson.vertexFromJson(new JSONObject(new JSONTokener(vertexJson1)));
        Vertex v2 = graphson.vertexFromJson(new JSONObject(new JSONTokener(vertexJson2)));
        Edge e = graphson.edgeFromJson(inputStreamEdgeJsonLight, v1, v2);

        Assert.assertSame(v1, g.getVertex(1));
        Assert.assertSame(v2, g.getVertex(2));
        Assert.assertSame(e, g.getEdge(0));
View Full Code Here

        public JettisonMappedReaderFactory(Configuration conf, DocumentDepthProperties depthProps) {
            super(conf);
            this.depthProps = depthProps;
        }
        protected JSONTokener createNewJSONTokener(String doc) {
            return new JSONTokener(doc, depthProps.getInnerElementCountThreshold());
        }
View Full Code Here

        final StringBuilder builder = new StringBuilder();
        try {
            for (String line; (line = reader.readLine()) != null; ) {
                builder.append(line).append("\n");
            }
            final JSONTokener tokener = new JSONTokener(builder.toString());
            final JSONObject rootObject = new JSONObject(tokener);

            final JSONObject responseObject = (JSONObject) rootObject.get("response");
            final int numFound = (Integer) responseObject.get("numFound");
            if(numFound == 0) {
View Full Code Here

                        jmConfig = new Configuration();
                    } else {
                        jmConfig = new Configuration(config.getXml2JsonNs());
                    }
                    return new MappedXMLStreamReader(
                            new JSONObject(new JSONTokener(ReaderWriter.readFromAsString(nonEmptyReader))),
                            new MappedNamespaceConvention(jmConfig));
                } catch (Exception ex) {
                    throw new XMLStreamException(ex);
                }
            case BADGERFISH:
                try {
                    return new BadgerFishXMLStreamReader(new JSONObject(new JSONTokener(ReaderWriter.readFromAsString
                            (nonEmptyReader))));
                } catch (Exception ex) {
                    throw new XMLStreamException(ex);
                }
        }
View Full Code Here

        public JettisonMappedReaderFactory(Map<?, ?> nstojns, DocumentDepthProperties depthProps) {
            super(nstojns);
            this.depthProps = depthProps;
        }
        protected JSONTokener createNewJSONTokener(String doc) {
            return new JSONTokener(doc, depthProps.getInnerElementCountThreshold());
        }
View Full Code Here

        public JettisonMappedReaderFactory(Map<?, ?> nstojns, DocumentDepthProperties depthProps) {
            super(nstojns);
            this.depthProps = depthProps;
        }
        protected JSONTokener createNewJSONTokener(String doc) {
            return new JSONTokener(doc, depthProps.getInnerElementCountThreshold());
        }
View Full Code Here

        public JettisonMappedReaderFactory(Configuration conf, DocumentDepthProperties depthProps) {
            super(conf);
            this.depthProps = depthProps;
        }
        protected JSONTokener createNewJSONTokener(String doc) {
            return new JSONTokener(doc, depthProps.getInnerElementCountThreshold());
        }
View Full Code Here

        public JettisonMappedReaderFactory(Configuration conf, DocumentDepthProperties depthProps) {
            super(conf);
            this.depthProps = depthProps;
        }
        protected JSONTokener createNewJSONTokener(String doc) {
            return new JSONTokener(doc, depthProps.getInnerElementCountThreshold());
        }
View Full Code Here

TOP

Related Classes of org.codehaus.jettison.json.JSONTokener

Copyright © 2018 www.massapicom. 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.