
com.electronwill.nightconfig.yaml.YamlFormat Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yaml Show documentation
Show all versions of yaml Show documentation
A multi-format configuration library, yaml module.
The newest version!
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 org.yaml.snakeyaml.Yaml;
import java.util.List;
import java.util.Set;
import java.util.Map;
import java.util.function.Supplier;
/**
* @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