/** * Construct configuration from yaml file, allows yaml to use include statements * * @param file to read */ public YamlPiplineConfiguration(File file) throws IOException { super(new IncludedYaml(new YamlFile(file))); }
@Override public Object dataTree() throws IOException { return processObject(yaml.dataTree()); }
/** * Construct configuration from raw yaml string. * * @param clazz * @param resourcePath * @throws Exception */ public YamlConfiguration(Class<?> clazz, String resourcePath) throws IOException { this(new YamlFile(clazz, resourcePath)); }
/** * Construct configuration from raw yaml string. * * @param yaml string * @throws Exception */ public YamlConfiguration(String yaml) throws IOException { this(new YamlString(yaml)); }
@Override public String originalConfig() throws IOException { return yaml.original(); } }
@SuppressWarnings("unchecked") private Object processObject(Object value) throws IOException { if (value instanceof Map) { return processMap((Map<String, Object>) value); } else if (value instanceof List) { return processList((List<Object>) value); } else { return value; } }
/** * Construct configuration the root data tree. * * @param root data tree * @throws Exception */ public YamlConfiguration(Yaml yaml) throws IOException { this.yaml = yaml; root = yaml.dataTree(); }
@Override protected String getSource() throws IOException { return formatted(); } }
/** * Construct configuration from yaml file, allows yaml to use include statements * * @param file to read */ public YamlPipelineConfiguration(File file) throws IOException { super(new IncludedYaml(new YamlFile(file))); }
/** * Read configuration from a file. * * @param file * @throws Exception */ public YamlConfiguration(File file) throws IOException { this(new YamlFile(file)); }
/** * New instance. * * @throws Exception */ public YamlConfiguration() throws IOException { this(new YamlString("")); }
@Override public Object dataTree() throws IOException { return processObject(yaml.dataTree()); }
@Override protected String getSource() throws IOException { return yaml.original(); } }
@SuppressWarnings("unchecked") private Object processObject(Object value) throws IOException { if (value instanceof Map) { return processMap((Map<String, Object>) value); } else if (value instanceof List) { return processList((List<Object>) value); } else { return value; } }
/** * Construct the IncludeYaml class wrapping the given yaml. Use, the default, file resolver to * find included configuration. * * @param yaml to wrap */ public IncludedYaml(Yaml yaml) { this(yaml, key -> new IncludedYaml(new YamlFile(new File(key)))); }
/** * Construct configuration from raw yaml string. * * @param clazz * @param resourcePath * @throws Exception */ public YamlConfiguration(Class<?> clazz, String resourcePath) throws IOException { this(new YamlFile(clazz, resourcePath)); }
/** * New instance. * * @throws Exception */ public YamlConfiguration() throws IOException { this(new YamlString("")); }
@Override protected String getSource() throws IOException { return yaml.original(); } }
@Override public Yaml apply(String key) { return new IncludedYaml(new YamlFile(YamlFileTest.class, key), this); } };
@Override public String originalConfig() throws IOException { return yaml.original(); } }