public static final class JsonSchemaFactory.Builder extends Object
JsonSchemaFactory| Modifier and Type | Field and Description |
|---|---|
private KeywordBundle |
bundle
The keyword bundle
|
private URI |
namespace
The namespace
|
private URIManager |
uriManager
The URI manager
|
| Constructor and Description |
|---|
JsonSchemaFactory.Builder()
No arg constructor
|
JsonSchemaFactory.Builder(KeywordBundle bundle)
Main constructor
|
| Modifier and Type | Method and Description |
|---|---|
JsonSchemaFactory.Builder |
addRedirection(String from,
String to)
Add an URI redirection
|
JsonSchemaFactory |
build()
Build the factory
|
JsonSchemaFactory.Builder |
registerKeyword(Keyword keyword)
Add a schema keyword to the bundle
|
JsonSchemaFactory.Builder |
registerScheme(String scheme,
URIDownloader downloader)
Register a
URIDownloader for a given scheme |
JsonSchemaFactory.Builder |
setNamespace(String namespace)
Set the schema registry's namespace
|
JsonSchemaFactory.Builder |
unregisterKeyword(String name)
Unregister a schema keyword
|
JsonSchemaFactory.Builder |
unregisterScheme(String scheme)
Unregister a scheme
|
private final KeywordBundle bundle
private final URIManager uriManager
private URI namespace
public JsonSchemaFactory.Builder()
This calls the main constructor with
KeywordBundles.defaultBundle() as an argument.
public JsonSchemaFactory.Builder(KeywordBundle bundle)
bundle - the keyword bundle to usepublic JsonSchemaFactory.Builder registerScheme(String scheme, URIDownloader downloader)
URIDownloader for a given schemescheme - the URI schemedownloader - the downloaderNullPointerException - scheme is nullIllegalArgumentException - illegal schemepublic JsonSchemaFactory.Builder unregisterScheme(String scheme)
scheme - the scheme to desupportpublic JsonSchemaFactory.Builder registerKeyword(Keyword keyword)
keyword - the keyword to addKeywordpublic JsonSchemaFactory.Builder unregisterKeyword(String name)
name - the name of the keyword to unregisterpublic JsonSchemaFactory.Builder setNamespace(String namespace)
namespace - the namespace, as a stringIllegalArgumentException - invalid URI (see URI.create(String))SchemaRegistrypublic JsonSchemaFactory.Builder addRedirection(String from, String to)
This allows you to add an alias for a schema location so that it point to another of your choice. It may be useful if you have to resolve absolute JSON References normally unreachable, but you have a copy of this schema locally.
Note that both URIs must be absolute.
from - the source URI, as a stringto - the target URI, as a stringIllegalArgumentException - either of the arguments is an
invalid URI, or it is not an absolute JSON ReferenceJsonRefpublic JsonSchemaFactory build()
Copyright © 2012. All Rights Reserved.