com.github.fge.jsonschema.cfg
Class ValidationConfigurationBuilder

java.lang.Object
  extended by com.github.fge.jsonschema.cfg.ValidationConfigurationBuilder
All Implemented Interfaces:
Thawed<ValidationConfiguration>

public final class ValidationConfigurationBuilder
extends Object
implements Thawed<ValidationConfiguration>

Validation configuration (mutable instance)

See Also:
ValidationConfiguration

Method Summary
 ValidationConfigurationBuilder addLibrary(String uri, Library library)
          Add a $schema and matching library to this configuration
 ValidationConfiguration freeze()
          Return a frozen version of this configuration
 ValidationConfigurationBuilder setDefaultLibrary(String uri, Library library)
          Add a library and sets it as the default
 ValidationConfigurationBuilder setDefaultVersion(SchemaVersion version)
          Set the default schema version for this configuration
 ValidationConfigurationBuilder setUseFormat(boolean useFormat)
          Tell whether the resulting configuration has support for format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addLibrary

public ValidationConfigurationBuilder addLibrary(String uri,
                                                 Library library)
Add a $schema and matching library to this configuration

Parameters:
uri - the value for $schema
library - the library
Returns:
this
Throws:
ValidationConfigurationError - provided URI is null, not a URI, or not an absolute JSON Reference; library is null; or there already exists a library for this value of $schema

setDefaultVersion

public ValidationConfigurationBuilder setDefaultVersion(SchemaVersion version)
Set the default schema version for this configuration

This will set the default library to use to the one registered for this schema version.

Parameters:
version - the version
Returns:
this
Throws:
ValidationConfigurationError - version is null

setDefaultLibrary

public ValidationConfigurationBuilder setDefaultLibrary(String uri,
                                                        Library library)
Add a library and sets it as the default

Parameters:
uri - the value for $schema
library - the library
Returns:
this
See Also:
addLibrary(String, Library)

setUseFormat

public ValidationConfigurationBuilder setUseFormat(boolean useFormat)
Tell whether the resulting configuration has support for format

Parameters:
useFormat - true if it must be used
Returns:
this

freeze

public ValidationConfiguration freeze()
Return a frozen version of this configuration

Specified by:
freeze in interface Thawed<ValidationConfiguration>
Returns:
a ValidationConfiguration
See Also:
ValidationConfiguration.ValidationConfiguration(ValidationConfigurationBuilder)


Copyright © 2014. All Rights Reserved.