
com.electronwill.nightconfig.yaml.YamlFormat Maven / Gradle / Ivy
package com.electronwill.nightconfig.yaml;
import com.electronwill.nightconfig.core.Config;
import com.electronwill.nightconfig.core.ConfigFormat;
import com.electronwill.nightconfig.core.file.FormatDetector;
import com.electronwill.nightconfig.core.io.ConfigParser;
import com.electronwill.nightconfig.core.io.ConfigWriter;
import com.electronwill.nightconfig.core.utils.Supplier;
import org.yaml.snakeyaml.Yaml;
import java.util.List;
import java.util.Set;
import java.util.Map;
/**
* @author TheElectronWill
*/
public final class YamlFormat implements ConfigFormat {
private static final ThreadLocal LOCAL_DEFAULT_FORMAT = ThreadLocal.withInitial(
() -> new YamlFormat(new Yaml()));
/**
* @return the default instance of HoconFormat
*/
public static YamlFormat defaultInstance() {
return LOCAL_DEFAULT_FORMAT.get();
}
/**
* Creates an instance of YamlFormat, set with the specified Yaml object.
*
* @param yaml the Yaml object to use
* @return a new instance of YamlFormat
*/
public static YamlFormat configuredInstance(Yaml yaml) {
return new YamlFormat(yaml);
}
/**
* @return a new config with the format {@link YamlFormat#defaultInstance()}.
*/
public static Config newConfig() {
return defaultInstance().createConfig();
}
/**
* @return a new config with the given map creator
*/
public static Config newConfig(Supplier
© 2015 - 2025 Weber Informatics LLC | Privacy Policy