/** * Create Yaml instance. It is safe to create a few instances and use them * in different Threads. * * @param constructor * BaseConstructor to construct incoming documents */ public Yaml(BaseConstructor constructor) { this(constructor, new Representer()); }
/** * Create Yaml instance. * * @param dumperOptions * DumperOptions to configure outgoing objects */ public Yaml(DumperOptions dumperOptions) { this(new Constructor(), new Representer(), dumperOptions); }
/** * Create Yaml instance. * * @param loadingConfig * LoadingConfig to control load behavior */ public Yaml(LoaderOptions loadingConfig) { this(new Constructor(), new Representer(), new DumperOptions(), loadingConfig); }
/** * Create Yaml instance. It is safe to create a few instances and use them * in different Threads. */ public Yaml() { this(new Constructor(), new Representer(), new DumperOptions(), new LoaderOptions(), new Resolver()); }
private Yaml newYaml() { return new Yaml(new SafeConstructor(), new Representer(), new DumperOptions(), new YamlTagResolver()); } }
@Override protected Yaml createYaml() { BaseConstructor constructor = new OriginTrackingConstructor(); Representer representer = new Representer(); DumperOptions dumperOptions = new DumperOptions(); LimitedResolver resolver = new LimitedResolver(); LoaderOptions loaderOptions = new LoaderOptions(); loaderOptions.setAllowDuplicateKeys(false); return new Yaml(constructor, representer, dumperOptions, loaderOptions, resolver); }
public static Yaml getSafeYaml(DumperOptions dumperOptions) { return getSafeYaml(new Representer(), dumperOptions); }
public YamlModelReader() { ModelConstructor constructor = new ModelConstructor(); yaml = new Yaml(constructor, new Representer(), new DumperOptions(), new ModelResolver()); }
/** * Create Yaml instance. It is safe to create a few instances and use them * in different Threads. * * @param constructor * BaseConstructor to construct incoming documents */ public Yaml(BaseConstructor constructor) { this(constructor, new Representer()); }
public YamlBuilder append(Map<?,?> map) { Yaml yaml = new Yaml(new Representer(), getDumperOptions()); append(yaml.dump(map)); return this; }
/** * Create Yaml instance. * * @param dumperOptions * DumperOptions to configure outgoing objects */ public Yaml(DumperOptions dumperOptions) { this(new Constructor(), new Representer(), dumperOptions); }
@SuppressWarnings("unchecked") private static Map<String, String> parseYamlStream(InputStream tenantStream) { Yaml yaml = new Yaml(new Constructor(), new Representer(), new DumperOptions(), new Resolver() { @Override protected void addImplicitResolvers() { } // forces all yaml values to be parsed as Strings } ); return (Map<String, String>) yaml.load(tenantStream); } }
@Bean Yaml yamlParser() { DumperOptions options = new DumperOptions(); options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); options.setDefaultScalarStyle(DumperOptions.ScalarStyle.PLAIN); return new Yaml(new SafeConstructor(), new Representer(), options); }
/** * Create Yaml instance. * * @param loadingConfig * LoadingConfig to control load behavior */ public Yaml(LoaderOptions loadingConfig) { this(new Constructor(), new Representer(), new DumperOptions(), loadingConfig); }
private static Yaml getYamlParser() { if (yamlParser == null) { DumperOptions options = new DumperOptions(); options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); options.setDefaultScalarStyle(DumperOptions.ScalarStyle.PLAIN); yamlParser = new Yaml(new SafeConstructor(), new Representer(), options); } return yamlParser; }
@Override protected Yaml initialValue() { DumperOptions options = new DumperOptions(); options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); options.setPrettyFlow(false); options.setIndent(2); return new Yaml(new YamlConstructor(), new Representer(), options); } };
public YamlFormatReader() { super(); this.yaml = new Yaml(new Constructor(), new Representer(), new DumperOptions(), new CustomResolver()); }
public ObjectNode loadString(String content) throws IOException { // here doesn't use jackson-dataformat-yaml so that snakeyaml calls Resolver // and Composer. See also YamlTagResolver. Yaml yaml = new Yaml(new SafeConstructor(), new Representer(), new DumperOptions(), new YamlTagResolver()); ObjectNode object = normalizeValidateObjectNode(yaml.load(content)); return object; }
PropertyUtils propUtils = new PropertyUtils(); propUtils.setAllowReadOnlyProperties(true); Representer repr = new Representer(); repr.setPropertyUtils(propUtils); Yaml yaml = new Yaml(new Constructor(), repr);
public ConfigElement loadString(String content) throws IOException { // here doesn't use jackson-dataformat-yaml so that snakeyaml calls Resolver // and Composer. See also YamlTagResolver. Yaml yaml = new Yaml(new StrictSafeConstructor(), new Representer(), new DumperOptions(), new YamlTagResolver()); ObjectNode object = normalizeValidateObjectNode(yaml.load(content)); return ConfigElement.of(object); }