Package org.yaml.snakeyaml.constructor

Examples of org.yaml.snakeyaml.constructor.SafeConstructor


        List value = new ArrayList();
        value.add(value);
        value.add("test");
        value.add(new Integer(1));

        Yaml yaml = new Yaml(new SafeConstructor());
        String output1 = yaml.dump(value);
        assertEquals("&id001\n- *id001\n- test\n- 1\n", output1);
        List value2 = (List) yaml.load(output1);
        assertEquals(3, value2.size());
        assertEquals(value.size(), value2.size());
View Full Code Here


        DumperOptions options = new DumperOptions();

        options.setIndent(4);
        options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);

        yaml = new Yaml(new SafeConstructor(), new EmptyNullRepresenter(), options);

        this.file = file;
    }
View Full Code Here

   *         referer and the value (RefererLookup)
   *         contains all known info about this referer
   */
  private Map<String,RefererLookup> loadReferers(InputStream referersYaml) throws CorruptYamlException {

    Yaml yaml = new Yaml(new SafeConstructor());
    Map<String,Map<String,Map>> rawReferers = (Map<String,Map<String,Map>>) yaml.load(referersYaml);

    // This will store all of our referers
    Map<String,RefererLookup> referers = new HashMap<String,RefererLookup>();

View Full Code Here

    options.setIndent(4);
    options.setDefaultFlowStyle(format.getStyle());
    Representer representer = new FancyRepresenter();
    representer.setDefaultFlowStyle(format.getStyle());

    yaml = new Yaml(new SafeConstructor(), representer, options);

    this.file = file;
  }
View Full Code Here

         DumperOptions options = new DumperOptions();
     
         options.setIndent(4);
         options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
     
         yaml = new Yaml(new SafeConstructor(), new EmptyNullRepresenter(), options);
     
         this.file = file;
      }
View Full Code Here

        DumperOptions options = new DumperOptions();

        options.setIndent(4);
        options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);

        yaml = new Yaml(new SafeConstructor(), new EmptyNullRepresenter(), options);

        this.file = file;
    }
View Full Code Here

        Object desc = convertFromRuby(runtime.runScriptlet("Plugin.getDescription"));
        if (!(desc instanceof Map)) {
            throw new InvalidDescriptionException("Plugin.getDescription must return a Map");
        }

        final Yaml yaml = new Yaml(new SafeConstructor());
        final StringReader reader = new StringReader( yaml.dump(desc) );
        return new PluginDescriptionFile(reader);
    }
View Full Code Here

    public void parse() throws NodeFileParserException {
        if (null == file && null == inputStream) {
            throw new NullPointerException("file or inputStream was not set");
        }
        final Reader reader;
        final Yaml yaml = new Yaml(new SafeConstructor());
        try {
            if (null != file) {
                reader = new FileReader(file);
            } else {
                reader = new InputStreamReader(inputStream);
View Full Code Here

            assertEquals("dev, ops, rundeck", node1.get("tags"));
        }
    }

    private Map parseYamlMap(String outputString) {
        Yaml yaml = new Yaml(new SafeConstructor());
        final Object load = yaml.load(new StringReader(outputString));
        assertNotNull(load);
        assertTrue(load instanceof Map);
        return (Map) load;
    }
View Full Code Here

        DumperOptions options = new DumperOptions();

        options.setIndent(4);
        options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);

        yaml = new Yaml(new SafeConstructor(), new EmptyNullRepresenter(), options);

        this.file = file;
    }
View Full Code Here

TOP

Related Classes of org.yaml.snakeyaml.constructor.SafeConstructor

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.