Search in sources :

Example 1 with Serializer

use of org.yaml.snakeyaml.serializer.Serializer in project configuration-as-code-plugin by jenkinsci.

the class ConfigurationAsCode method serializeYamlNode.

// for testing only
@Restricted(NoExternalUse.class)
public static void serializeYamlNode(Node root, Writer writer) throws IOException {
    DumperOptions options = new DumperOptions();
    options.setDefaultFlowStyle(BLOCK);
    options.setDefaultScalarStyle(PLAIN);
    options.setSplitLines(true);
    options.setPrettyFlow(true);
    Serializer serializer = new Serializer(new Emitter(writer, options), new Resolver(), options, null);
    serializer.open();
    serializer.serialize(root);
    serializer.close();
}
Also used : Emitter(org.yaml.snakeyaml.emitter.Emitter) Resolver(org.yaml.snakeyaml.resolver.Resolver) DumperOptions(org.yaml.snakeyaml.DumperOptions) Serializer(org.yaml.snakeyaml.serializer.Serializer) Restricted(org.kohsuke.accmod.Restricted)

Aggregations

Restricted (org.kohsuke.accmod.Restricted)1 DumperOptions (org.yaml.snakeyaml.DumperOptions)1 Emitter (org.yaml.snakeyaml.emitter.Emitter)1 Resolver (org.yaml.snakeyaml.resolver.Resolver)1 Serializer (org.yaml.snakeyaml.serializer.Serializer)1