Package org.yaml.snakeyaml.nodes

Examples of org.yaml.snakeyaml.nodes.Tag


        }
    }

    public static class ExtendedConstructor extends Constructor {
        public ExtendedConstructor() {
            this.yamlConstructors.put(new Tag("!Custom"), new ConstructCustom());
        }
View Full Code Here


        }

        public class FileRepresenter implements Represent {
            public Node representData(Object data) {
                File file = (File) data;
                Node scalar = representScalar(new Tag("!!java.io.File"), file.getAbsolutePath());
                return scalar;
            }
View Full Code Here

public class BeanConstructor extends Constructor {

    public BeanConstructor() {
        super(BeanHolder.class);
        yamlConstructors.put(new Tag(Bean1.class), new Bean1ScalarConstructor());
        yamlConstructors.put(new Tag(BeanHolder.class), new BeanHolderScalarConstructor());
    }
View Full Code Here

import org.yaml.snakeyaml.nodes.Tag;

public class BeanConstructor3 extends Constructor {

    public BeanConstructor3() {
        yamlConstructors.put(new Tag(BeanHolder.class), new BeanHolderScalarConstructor());
    }
View Full Code Here

        }

        private class RepresentClass implements Represent {
            public Node representData(Object data) {
                Class<?> clazz = (Class<?>) data;
                return representScalar(new Tag("!clazz"), clazz.getSimpleName());
            }
View Full Code Here

        }
    }

    static class ClassConstructor extends Constructor {
        public ClassConstructor() {
            this.yamlConstructors.put(new Tag("!clazz"), new ConstructClass());
        }
View Full Code Here

    public void testLongRepresenter() {
        DumperOptions options = new DumperOptions();
        options.setDefaultScalarStyle(DumperOptions.ScalarStyle.DOUBLE_QUOTED);
        Representer repr = new Representer();
        repr.addClassTag(Long.class, new Tag("!!java.lang.Long"));
        Yaml yaml = new Yaml(repr, options);

        Foo foo = new Foo();
        String output = yaml.dump(foo);
        // System.out.println(output);
View Full Code Here

        assertEquals(4, ((Car) result).getWheels().size());
    }

    private Yaml yaml() {
        Yaml yaml = new Yaml(new MyConstructor());
        yaml.addImplicitResolver(new Tag("!wheel"), Pattern.compile("w#\\d+"), "w");
        return yaml;
    }
View Full Code Here

        return new StringReader(doc.toString());
    }

    private class MyConstructor extends Constructor {
        public MyConstructor() {
            yamlConstructors.put(new Tag("!car"), new ConstructCar());
            yamlConstructors.put(new Tag("!wheel"), new ConstructWheel());
        }
View Full Code Here

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

        Constructor constructor = new Constructor();
        Representer representer = new Representer();
        Tag generalAccountTag = new Tag("!GA");
        constructor
                .addTypeDescription(new TypeDescription(GeneralAccount.class, generalAccountTag));
        representer.addClassTag(GeneralAccount.class, generalAccountTag);

        Yaml yaml = new Yaml(constructor, representer);
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.