java.lang.Object
de.iip_ecosphere.platform.support.yaml.Yaml
de.oktoflow.platform.support.yaml.snakeyaml.SnakeYaml

public class SnakeYaml extends de.iip_ecosphere.platform.support.yaml.Yaml
Implements the YAML interface by SnakeYaml.
Author:
Holger Eichelberger, SSE
  • Constructor Details

    • SnakeYaml

      public SnakeYaml()
  • Method Details

    • load

      public Object load(InputStream in) throws IOException
      Specified by:
      load in class de.iip_ecosphere.platform.support.yaml.Yaml
      Throws:
      IOException
    • loadMapping

      public Map<String,Object> loadMapping(InputStream in) throws IOException
      Specified by:
      loadMapping in class de.iip_ecosphere.platform.support.yaml.Yaml
      Throws:
      IOException
    • loadMapping

      public Map<String,Object> loadMapping(InputStream in, Map<String,Predicate<Object>> conds) throws IOException
      Specified by:
      loadMapping in class de.iip_ecosphere.platform.support.yaml.Yaml
      Throws:
      IOException
    • loadAs

      public <T> T loadAs(String in, Class<T> cls) throws IOException
      Specified by:
      loadAs in class de.iip_ecosphere.platform.support.yaml.Yaml
      Throws:
      IOException
    • loadAs

      public <T> T loadAs(InputStream in, Class<T> cls) throws IOException
      Specified by:
      loadAs in class de.iip_ecosphere.platform.support.yaml.Yaml
      Throws:
      IOException
    • loadAll

      public Iterator<Object> loadAll(InputStream in, String path, Class<?> cls) throws IOException
      Overrides:
      loadAll in class de.iip_ecosphere.platform.support.yaml.Yaml
      Throws:
      IOException
    • loadAll

      public Iterator<Object> loadAll(InputStream in, String path, Class<?> cls, Map<String,Predicate<Object>> conds) throws IOException
      Specified by:
      loadAll in class de.iip_ecosphere.platform.support.yaml.Yaml
      Throws:
      IOException
    • matchesConditions

      private boolean matchesConditions(Map<String,Object> data, Map<String,Predicate<Object>> conds)
      Returns whether at least one condition in conds holds for the specified mapping.
      Parameters:
      data - the data containing the mapping
      conds - the conditions with key = "."-separated key in data and value = the predicate checking the value for the associated key, conds may be null
      Returns:
      true if there are no conditions and data is not null or if at least one condition meets, false else
    • loadAll

      public Iterator<Object> loadAll(InputStream in) throws IOException
      Specified by:
      loadAll in class de.iip_ecosphere.platform.support.yaml.Yaml
      Throws:
      IOException
    • createYaml

      private static org.yaml.snakeyaml.Yaml createYaml(Class<?> cls)
      Creates a tolerant YAML object to read objects of type cls.
      Parameters:
      cls - the type to read, may be null
      Returns:
      the yamp object
    • loadTolerantAs

      public <T> T loadTolerantAs(InputStream in, Class<T> cls)
      Specified by:
      loadTolerantAs in class de.iip_ecosphere.platform.support.yaml.Yaml
    • initDumperOptions

      private static org.yaml.snakeyaml.DumperOptions initDumperOptions(org.yaml.snakeyaml.representer.Representer representer)
      Initialize dumper from representer, takeover in migration from 1.27 to 2.3.
      Parameters:
      representer - the representer to initialize from
      Returns:
      the initialized dumper
    • dump

      public String dump(Object object) throws IOException
      Specified by:
      dump in class de.iip_ecosphere.platform.support.yaml.Yaml
      Throws:
      IOException
    • dump

      public void dump(Object object, Class<?> cls, Writer out) throws IOException
      Specified by:
      dump in class de.iip_ecosphere.platform.support.yaml.Yaml
      Throws:
      IOException