
com.github.akurilov.confuse.io.yaml.YamlSchemaProviderBase Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of confuse-io-yaml Show documentation
Show all versions of confuse-io-yaml Show documentation
Configuration serialization/deserialization to/from YAML
The newest version!
package com.github.akurilov.confuse.io.yaml;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.dataformat.yaml.YAMLMapper;
import com.github.akurilov.confuse.SchemaProvider;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
public abstract class YamlSchemaProviderBase
implements SchemaProvider {
@Override
public Map schema()
throws IOException {
final var m = new YAMLMapper()
.enable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)
.enable(DeserializationFeature.FAIL_ON_READING_DUP_TREE_KEY)
.enable(SerializationFeature.INDENT_OUTPUT);
final Map rawSchema;
try(final var input = schemaInputStream()) {
rawSchema = m.readValue(input, new TypeReference
© 2015 - 2025 Weber Informatics LLC | Privacy Policy