constructor.setPropertyUtils(representer.getPropertyUtils()); } else if (!representer.isExplicitPropertyUtils()) { representer.setPropertyUtils(constructor.getPropertyUtils());
public void storeBodoDescriptor(BODODescriptor bodoDescriptor) throws IOException { Representer representer = new Representer(); representer.setPropertyUtils(new PropertyOrderingUtils()); Yaml yaml = new Yaml(representer); storeString(yaml.dump(bodoDescriptor)); }
PropertyUtils propUtils = new PropertyUtils(); propUtils.setAllowReadOnlyProperties(true); Representer repr = new Representer(); repr.setPropertyUtils(propUtils); Yaml yaml = new Yaml(new Constructor(), repr);
/** * 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); }
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); }
constructor.setPropertyUtils(representer.getPropertyUtils()); } else if (!representer.isExplicitPropertyUtils()) { representer.setPropertyUtils(constructor.getPropertyUtils());
constructor.setPropertyUtils(representer.getPropertyUtils()); } else if (!representer.isExplicitPropertyUtils()) { representer.setPropertyUtils(constructor.getPropertyUtils());
constructor.setPropertyUtils(representer.getPropertyUtils()); } else if (!representer.isExplicitPropertyUtils()) { representer.setPropertyUtils(constructor.getPropertyUtils());