Package net.hamnaberg.json.parser

Examples of net.hamnaberg.json.parser.CollectionParser


            }
        }
    }

    private static void parseAndDump(InputStream stream) throws IOException {
        Collection collection = new CollectionParser().parse(stream);
        System.err.println("Parsed Collection with href: " + collection.getHref());
        System.out.println(collection.toString());
    }
View Full Code Here


    @Test
    public void canParseGeneratedTemplate() throws Exception {
        Template template = Template.create(Arrays.asList(Property.value("one", Optional.of("One"), Optional.<Value>empty())));
        StringWriter writer = new StringWriter();
        template.writeTo(writer);
        Template parsed = new CollectionParser().parseTemplate(writer.toString());
        assertEquals(template, parsed);
    }
View Full Code Here

        List<Item> items = new ArrayList<Item>();
        items.add(Item.create(COLLECTION_URI.resolve("item/1"), Arrays.asList(Property.value("one", Optional.of("One"), ValueFactory.createOptionalValue(1))), Collections.<Link>emptyList()));

        Collection collection = Collection.builder(COLLECTION_URI).addItems(items).build();
        String generated = collection.toString();
        Collection parsed = new CollectionParser().parse(generated);
        assertEquals(collection.toString(), parsed.toString());
    }
View Full Code Here

TOP

Related Classes of net.hamnaberg.json.parser.CollectionParser

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.