All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.apicurio.registry.serde.jsonschema.JsonSchemaDeserializerConfig Maven / Gradle / Ivy

package io.apicurio.registry.serde.jsonschema;

import io.apicurio.registry.serde.config.SerdeConfig;

import java.util.HashMap;
import java.util.Map;

public class JsonSchemaDeserializerConfig extends SerdeConfig {

    private boolean isKey;

    /**
     * Constructor.
     *
     * @param originals
     */
    public JsonSchemaDeserializerConfig(Map originals) {
        Map joint = new HashMap<>(getDefaults());
        joint.putAll(originals);
        this.originals = joint;
    }

    public JsonSchemaDeserializerConfig(Map originals, boolean isKey) {
        Map joint = new HashMap<>(getDefaults());
        joint.putAll(originals);
        this.originals = joint;
        this.isKey = isKey;
    }

    public Class getSpecificReturnClass() {
        if (isKey) {
            return this.getClass(DESERIALIZER_SPECIFIC_KEY_RETURN_CLASS);
        } else {
            return this.getClass(DESERIALIZER_SPECIFIC_VALUE_RETURN_CLASS);
        }
    }

    public boolean validationEnabled() {
        return this.getBoolean(VALIDATION_ENABLED);
    }

    @Override
    protected Map getDefaults() {
        Map joint = new HashMap<>(super.getDefaults());
        joint.putAll(DEFAULTS);
        return joint;
    }

    private static final Map DEFAULTS = Map.of(VALIDATION_ENABLED, VALIDATION_ENABLED_DEFAULT);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy