private static DumperOptions initDumperOptions(Representer representer) { DumperOptions dumperOptions = new DumperOptions(); dumperOptions.setDefaultFlowStyle(representer.getDefaultFlowStyle()); dumperOptions.setDefaultScalarStyle(representer.getDefaultScalarStyle()); dumperOptions.setAllowReadOnlyProperties(representer.getPropertyUtils().isAllowReadOnlyProperties()); dumperOptions.setTimeZone(representer.getTimeZone()); return dumperOptions; }
private static DumperOptions getDumperOptions() { DumperOptions options = new DumperOptions(); options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); options.setIndent(4); options.setAllowReadOnlyProperties(true); options.setExplicitStart(true); return options; }
protected static void toYaml(OutputStream out, Object info) throws IOException { if (info == null) { return; } DumperOptions options = new DumperOptions(); options.setAllowReadOnlyProperties(true); options.setDefaultFlowStyle(FlowStyle.BLOCK); Yaml yaml = new Yaml(new YamlAutomationRepresenter(), options); Writer writer = new OutputStreamWriter(out); yaml.dump(info, writer); }
/** * Creates and returns a new {@link Yaml} instance for (optional) * use in writing {@link ConfigOrBuilder} and {@link * MetadataOrBuilder} objects. * * <p>This method never returns {@code null}.</p> * * <p>Overrides of this method must not return {@code null}.</p> * * <p>Behavior is undefined if overrides of this method interact * with other methods defined by this class.</p> * * @return a non-{@code null} {@link Yaml} instance */ protected Yaml createYaml() { final Representer representer = new TerseRepresenter(); representer.setPropertyUtils(new CustomPropertyUtils()); final DumperOptions options = new DumperOptions(); options.setAllowReadOnlyProperties(true); return new Yaml(new SafeConstructor(), representer, options); }
/** * Creates and returns a new {@link Yaml} instance for (optional) * use in writing {@link ConfigOrBuilder} and {@link * MetadataOrBuilder} objects. * * <p>This method never returns {@code null}.</p> * * <p>Overrides of this method must not return {@code null}.</p> * * <p>Behavior is undefined if overrides of this method interact * with other methods defined by this class.</p> * * @return a non-{@code null} {@link Yaml} instance */ protected Yaml createYaml() { final Representer representer = new TerseRepresenter(); representer.setPropertyUtils(new CustomPropertyUtils()); final DumperOptions options = new DumperOptions(); options.setAllowReadOnlyProperties(true); return new Yaml(new SafeConstructor(), representer, options); }
protected Yaml buildYaml() { Constructor constructor = new Constructor(); Representer representer = new Representer(); representer.setDefaultFlowStyle(FlowStyle.BLOCK); representer.setDefaultScalarStyle(ScalarStyle.PLAIN); DumperOptions dumperOptions = new DumperOptions(); dumperOptions.setAllowReadOnlyProperties(true); dumperOptions.setDefaultFlowStyle(FlowStyle.BLOCK); dumperOptions.setDefaultScalarStyle(ScalarStyle.PLAIN); dumperOptions.setLineBreak(this.getLineBreak()); LimitedResolver limitedResolver = new LimitedResolver(); return new Yaml(constructor, representer, dumperOptions, limitedResolver); }
public static Yaml newYaml() { PropertyUtils propertyUtils = new AdvancedPropertyUtils(); propertyUtils.setSkipMissingProperties(true); propertyUtils.setAllowReadOnlyProperties(false); Constructor constructor = new Constructor(); Representer representer = new AdvancedRepresenter(); representer.setPropertyUtils(propertyUtils); representer.addClassTag(CircusTrainConfig.class, Tag.MAP); DumperOptions dumperOptions = new DumperOptions(); dumperOptions.setIndent(2); dumperOptions.setDefaultFlowStyle(FlowStyle.BLOCK); dumperOptions.setAllowReadOnlyProperties(true); return new Yaml(constructor, representer, dumperOptions); }
private static DumperOptions initDumperOptions(Representer representer) { DumperOptions dumperOptions = new DumperOptions(); dumperOptions.setDefaultFlowStyle(representer.getDefaultFlowStyle()); dumperOptions.setDefaultScalarStyle(representer.getDefaultScalarStyle()); dumperOptions.setAllowReadOnlyProperties(representer.getPropertyUtils().isAllowReadOnlyProperties()); dumperOptions.setTimeZone(representer.getTimeZone()); return dumperOptions; }