Package org.yaml.snakeyaml.nodes

Examples of org.yaml.snakeyaml.nodes.Tag


    public void testDumpEscapedTag() {
        Académico obj = new Académico();
        obj.setId(123);
        obj.setName("Foo bar 123");
        Representer repr = new Representer();
        repr.addClassTag(Académico.class, new Tag("!Académico"));
        Yaml yaml = new Yaml(repr);
        String result = yaml.dump(obj);
        assertEquals("!Acad%C3%A9mico {id: 123, name: Foo bar 123}\n", result);
    }
View Full Code Here


        String result = yaml.dump(obj);
        assertEquals("!Acad%C3%A9mico {id: 123, name: Foo bar 123}\n", result);
    }

    public void testTag() {
        Tag tag = new Tag("!java/javabean:foo.Bar");
        assertEquals("!java/javabean:foo.Bar", tag.getValue());
    }
View Full Code Here

        private class RepresentDice implements Represent {
            public Node representData(Object data) {
                CustomBean coin = (CustomBean) data;
                String value = coin.getPrefix() + "d" + coin.getSuffix();
                return representScalar(new Tag("!!Dice"), value);
            }
View Full Code Here

        }
    }

    class MyConstructor extends Constructor {
        public MyConstructor() {
            this.yamlConstructors.put(new Tag(Tag.PREFIX + "Dice"), new ConstructDice());
        }
View Full Code Here

    }

    public void testDumperDifferentTag() {
        Yaml yaml = new Yaml();
        Bean124 bean = new Bean124();
        String output1 = yaml.dumpAs(bean, new Tag("!!foo.bar"), FlowStyle.BLOCK);
        assertEquals("!!foo.bar\na: aaa\nnumbers:\n- 1\n- 2\n- 3\n", output1);
    }
View Full Code Here

    }

    public void testDumperFlowStyle() {
        Yaml yaml = new Yaml();
        Bean124 bean = new Bean124();
        String output1 = yaml.dumpAs(bean, new Tag("!!foo.bar"), FlowStyle.FLOW);
        assertEquals("!!foo.bar {a: aaa, numbers: [1, 2, 3]}\n", output1);
    }
View Full Code Here

    }

    public void testDumperAutoStyle() {
        Yaml yaml = new Yaml();
        Bean124 bean = new Bean124();
        String output1 = yaml.dumpAs(bean, new Tag("!!foo.bar"), FlowStyle.AUTO);
        assertEquals("!!foo.bar\na: aaa\nnumbers: [1, 2, 3]\n", output1);
    }
View Full Code Here

    }

    public void testDumperNullStyle() {
        Yaml yaml = new Yaml();
        Bean124 bean = new Bean124();
        String output1 = yaml.dumpAs(bean, new Tag("!!foo.bar"), null);
        assertEquals("!!foo.bar\na: aaa\nnumbers: [1, 2, 3]\n", output1);
    }
View Full Code Here

    public void testDumperNullStyle2() {
        DumperOptions options = new DumperOptions();
        options.setDefaultFlowStyle(FlowStyle.BLOCK);
        Yaml yaml = new Yaml(options);
        Bean124 bean = new Bean124();
        String output1 = yaml.dumpAs(bean, new Tag("!!foo2.bar2"), null);
        assertEquals("!!foo2.bar2\na: aaa\nnumbers:\n- 1\n- 2\n- 3\n", output1);
    }
View Full Code Here

            this.representers.put(Custom.class, new RepresentCustom());
        }

        private class RepresentCustom implements Represent {
            public Node representData(Object data) {
                return representScalar(new Tag("!Custom"), ((Custom) data).toString());
            }
View Full Code Here

TOP

Related Classes of org.yaml.snakeyaml.nodes.Tag

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.