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

com.github.fge.jsonschema.cfg.LoadingConfiguration Maven / Gradle / Ivy

There is a newer version: 2.2.6
Show newest version
package com.github.fge.jsonschema.cfg;

import com.fasterxml.jackson.databind.JsonNode;
import com.github.fge.jsonschema.library.Dictionary;
import com.github.fge.jsonschema.load.Dereferencing;
import com.github.fge.jsonschema.load.URIDownloader;
import com.github.fge.jsonschema.util.Frozen;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;

import java.net.URI;
import java.util.Map;

public final class LoadingConfiguration
    implements Frozen
{
    final Dictionary downloaders;
    final URI namespace;
    final Dereferencing dereferencing;
    final Map schemaRedirects;
    final Map preloadedSchemas;

    public static LoadingConfigurationBuilder newConfiguration()
    {
        return new LoadingConfigurationBuilder();
    }

    public static LoadingConfiguration byDefault()
    {
        return new LoadingConfigurationBuilder().freeze();
    }

    LoadingConfiguration(final LoadingConfigurationBuilder cfg)
    {
        downloaders = cfg.downloaders.freeze();
        namespace = cfg.namespace;
        dereferencing = cfg.dereferencing;
        schemaRedirects = Maps.newHashMap(cfg.schemaRedirects);
        preloadedSchemas = Maps.newHashMap(cfg.preloadedSchemas);
    }

    public Dictionary getDownloaders()
    {
        return downloaders;
    }

    public URI getNamespace()
    {
        return namespace;
    }

    public Dereferencing getDereferencing()
    {
        return dereferencing;
    }

    public Map getSchemaRedirects()
    {
        return ImmutableMap.copyOf(schemaRedirects);
    }

    public Map getPreloadedSchemas()
    {
        return ImmutableMap.copyOf(preloadedSchemas);
    }

    @Override
    public LoadingConfigurationBuilder thaw()
    {
        return new LoadingConfigurationBuilder(this);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy