Examples of dumpAsMap()


Examples of org.yaml.snakeyaml.Yaml.dumpAsMap()

        Bean124 bean = new Bean124();
        String output0 = yaml.dump(bean);
        // System.out.println(output0);
        assertEquals("!!org.yaml.snakeyaml.issues.issue124.Bean124\na: aaa\nnumbers: [1, 2, 3]\n",
                output0);
        String output1 = yaml.dumpAsMap(bean);
        // System.out.println(output1);
        assertEquals("a: aaa\nnumbers:\n- 1\n- 2\n- 3\n", output1);
        String output2 = yaml.dump(bean);
        // System.out.println(output2);
        assertEquals("Yaml.dumpAs() should not have any side effects.", output0, output2);
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml.dumpAsMap()

        children.add(daughter);
        father.setChildren(children);
        mother.setChildren(children);
        //
        Yaml beanDumper = new Yaml();
        String output = beanDumper.dumpAsMap(son);
        // System.out.println(output);
        String etalon = Util.getLocalResource("recursive/with-children-no-root-tag.yaml");
        assertEquals(etalon, output);
        TypeDescription humanDescription = new TypeDescription(Human.class);
        humanDescription.putMapPropertyType("children", Human.class, Object.class);
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml.dumpAsMap()

        reminders.put("tomorrow", "go shoping");
        house.setReminders(reminders);
        house.setNumber(1);
        house.setStreet("Wall Street");
        Yaml beanDumper = new Yaml();
        String yaml = beanDumper.dumpAsMap(house);
        String etalon = Util.getLocalResource("javabeans/house-dump1.yaml");
        assertEquals(etalon, yaml);
        // load
        Yaml beanLoader = new Yaml();
        House loadedHouse = beanLoader.loadAs(yaml, House.class);
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml.dumpAsMap()

        reminders.put("tomorrow", "go shoping");
        house.setReminders(reminders);
        house.setNumber(1);
        house.setStreet("Wall Street");
        Yaml beanDumper = new Yaml();
        String yaml = beanDumper.dumpAsMap(house);
        String etalon = Util.getLocalResource("javabeans/house-dump3.yaml");
        assertEquals(etalon, yaml);
        // load
        TypeDescription description = new TypeDescription(House.class);
        description.putListPropertyType("rooms", Room.class);
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml.dumpAsMap()

    }

    public void testDumpChildrenArrayWithoutRootTag() {
        Yaml yaml = new Yaml();
        Human_WithArrayOfChildren son = createSon();
        String output = yaml.dumpAsMap(son);
        // System.out.println(output);
        String etalon = Util.getLocalResource("recursive/with-childrenArray-no-root-tag.yaml");
        assertEquals(etalon, output);
    }
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml.dumpAsMap()

    public void testFilterPropertyInJavaBeanDumper() {
        BeanToRemoveProperty bean = new BeanToRemoveProperty();
        bean.setNumber(24);
        bean.setId("ID124");
        Yaml d = new Yaml();
        String dump = d.dumpAsMap(bean);
        // System.out.println(dump);
        assertEquals("id: ID124\nnumber: 24\n", dump);
    }

    public void testFilterPropertyInYaml() {
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml.dumpAsMap()

    public void testFilterPropertyInYaml() {
        BeanToRemoveProperty bean = new BeanToRemoveProperty();
        bean.setNumber(25);
        bean.setId("ID125");
        Yaml yaml = new Yaml(new MyRepresenter());
        String dump = yaml.dumpAsMap(bean);
        // System.out.println(dump);
        assertEquals("number: 25\n", dump);
    }

    public void testDoNotFilterPropertyIncludeReadOnly() {
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml.dumpAsMap()

    public void testGenericList() {
        Yaml yaml = new Yaml();
        ListProvider<String> listProvider = new ListProvider<String>();
        listProvider.getList().add("foo");
        listProvider.getList().add("bar");
        String s = yaml.dumpAsMap(listProvider);
        // System.out.println(s);
        assertEquals("list:\n- foo\n- bar\n", s);
        // parse
        Yaml loader = new Yaml();
        ListProvider<String> listProvider2 = loader.loadAs(s, ListProvider.class);
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml.dumpAsMap()

        listProvider.getList().add(foo);
        Bean bar = new Bean();
        bar.setName("bar");
        bar.setNumber(3);
        listProvider.getList().add(bar);
        String s = yaml.dumpAsMap(listProvider);
        // System.out.println(s);
        String etalon = Util.getLocalResource("issues/issue61-1.yaml");
        assertEquals(etalon, s);
        // parse
        Yaml loader = new Yaml();
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml.dumpAsMap()

        customerAB.aAll = all;
        customerAB.bGeneral = general;

        Yaml yaml = new Yaml();
        String dump2 = yaml.dumpAsMap(customerAB);
        // System.out.println(dump2);
        Yaml loader = new Yaml();
        CustomerAB parsed = loader.loadAs(dump2, CustomerAB.class);
        assertNotNull(parsed);
    }
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.