Package org.yaml.snakeyaml.representer

Examples of org.yaml.snakeyaml.representer.Representer


public class ProvisionerProfileHelper {
  public static JProvisionerProfile fromFile(final File file) throws FileNotFoundException {
    if (file == null) {
      throw new FileNotFoundException("null obviously could not be found");
    }
    final Representer r = new Representer();
    r.getPropertyUtils().setSkipMissingProperties(true);
    final Yaml yaml = new Yaml(new CustomClassLoaderConstructor(JProvisionerProfile.class), r);
    final InputStream fis = new FileInputStream(file);
    JProvisionerProfile p = null;
    try {
      p = (JProvisionerProfile) yaml.load(fis);
View Full Code Here


        this.format = format;

        DumperOptions options = new FancyDumperOptions();
        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

    this.yamlModel = yamlModel;
  }

  @Override
  public Yaml get() {
    Representer representer = new Representer();

    for (EtcKey key : yamlModel.keySet()) {
      representer.addClassTag(key.get(), Tag.MAP);
    }

    NaturalPropertyUtils propertyUtils = new NaturalPropertyUtils();
    representer.setPropertyUtils(propertyUtils);

    DumperOptions options = new DumperOptions();
    options.setDefaultFlowStyle(FlowStyle.BLOCK);

    return new org.yaml.snakeyaml.Yaml(
View Full Code Here

      return value;
   }

   protected List<?> loadYamlData(final Reader io) throws IOException {
      final Yaml yaml = new Yaml(new Constructor(), new Representer(),
            new DumperOptions(), new YamlParserResolver());
      final Object loadedYaml = yaml.load(io);

      if (loadedYaml instanceof ArrayList) {
         return (ArrayList<?>) loadedYaml;
View Full Code Here

      return value;
   }

   protected List<?> loadYamlData(final Reader io) throws IOException {
      final Yaml yaml = new Yaml(new Constructor(), new Representer(),
            new DumperOptions(), new YamlParserResolver());
      final Object loadedYaml = yaml.load(io);

      if (loadedYaml instanceof ArrayList) {
         return (ArrayList<?>) loadedYaml;
View Full Code Here

    this.yamlModel = yamlModel;
  }

  @Override
  public Yaml get() {
    Representer representer = new Representer();

    for (ConfigKey key : yamlModel.keySet()) {
      representer.addClassTag(key.get(), Tag.MAP);
    }

    NaturalPropertyUtils propertyUtils = new NaturalPropertyUtils();
    representer.setPropertyUtils(propertyUtils);

    DumperOptions options = new DumperOptions();
    options.setDefaultFlowStyle(FlowStyle.BLOCK);

    return new org.yaml.snakeyaml.Yaml(
View Full Code Here

      return value;
   }

   protected List<?> loadYamlData(final Reader io) throws IOException {
      final Yaml yaml = new Yaml(new Constructor(), new Representer(),
            new DumperOptions(), new YamlParserResolver());
      final Object loadedYaml = yaml.load(io);

      if (loadedYaml instanceof ArrayList) {
         return (ArrayList<?>) loadedYaml;
View Full Code Here

  @Nullable
  private static Map<String, Object> loadPubspecYamlInfo(final @NotNull String pubspecYamlFileContents) {
    // see com.google.dart.tools.core.utilities.yaml.PubYamlUtils#parsePubspecYamlToMap()
    // deprecated constructor used to be compatible with old snakeyaml version in testng.jar (it wins when running from sources or tests)
    //noinspection deprecation
    final Yaml yaml = new Yaml(new Loader(new Constructor()), new Dumper(new Representer(), new DumperOptions()), new Resolver() {
      @Override
      protected void addImplicitResolvers() {
        addImplicitResolver(Tag.NULL, NULL, "~nN\0");
        addImplicitResolver(Tag.NULL, EMPTY, null);
        addImplicitResolver(Tag.VALUE, VALUE, "=");
View Full Code Here

    DumperOptions options = new DumperOptions();

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

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

    this.file = file;
  }
View Full Code Here

   }

   public Yaml createYamlReader()
   {
      final Yaml yaml = new Yaml(new Constructor(), new Representer(), new DumperOptions(),
            new Resolver()
      {
         @Override
         protected void addImplicitResolvers()
         {
View Full Code Here

TOP

Related Classes of org.yaml.snakeyaml.representer.Representer

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.