com.github.fge.jsonschema.walk.SchemaWalkingConfigurationBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of json-schema-core Show documentation
Show all versions of json-schema-core Show documentation
Core processing architecture for json-schema-validator
package com.github.fge.jsonschema.walk;
import com.github.fge.jsonschema.CoreMessageBundle;
import com.github.fge.jsonschema.library.Dictionary;
import com.github.fge.jsonschema.load.configuration.LoadingConfiguration;
import com.github.fge.jsonschema.syntax.SyntaxMessageBundle;
import com.github.fge.jsonschema.syntax.checkers.SyntaxChecker;
import com.github.fge.jsonschema.syntax.dictionaries.DraftV4SyntaxCheckerDictionary;
import com.github.fge.jsonschema.util.Thawed;
import com.github.fge.jsonschema.walk.collectors.DraftV4PointerCollectorDictionary;
import com.github.fge.jsonschema.walk.collectors.PointerCollector;
import com.github.fge.msgsimple.bundle.MessageBundle;
public final class SchemaWalkingConfigurationBuilder
implements Thawed
{
private static final CoreMessageBundle BUNDLE
= CoreMessageBundle.getInstance();
Dictionary collectors;
Dictionary checkers;
MessageBundle bundle;
LoadingConfiguration loadingCfg;
SchemaWalkingConfigurationBuilder()
{
collectors = DraftV4PointerCollectorDictionary.get();
checkers = DraftV4SyntaxCheckerDictionary.get();
loadingCfg = LoadingConfiguration.byDefault();
bundle = SyntaxMessageBundle.get();
}
SchemaWalkingConfigurationBuilder(final SchemaWalkingConfiguration cfg)
{
collectors = cfg.collectors;
checkers = cfg.checkers;
loadingCfg = cfg.loadingCfg;
}
public SchemaWalkingConfigurationBuilder setCheckers(
final Dictionary checkers)
{
this.checkers = checkers;
return this;
}
public SchemaWalkingConfigurationBuilder setCollectors(
final Dictionary collectors)
{
this.collectors = collectors;
return this;
}
public SchemaWalkingConfigurationBuilder setMessageBundle(
final MessageBundle bundle)
{
BUNDLE.checkNotNull(bundle, "processing.nullBundle");
this.bundle = bundle;
return this;
}
public SchemaWalkingConfigurationBuilder setLoadingConfiguration(
final LoadingConfiguration loadingCfg)
{
BUNDLE.checkNotNull(loadingCfg, "processing.nullLoadingCfg");
this.loadingCfg = loadingCfg;
return this;
}
@Override
public SchemaWalkingConfiguration freeze()
{
return new SchemaWalkingConfiguration(this);
}
}