public static final class JsonSchemaFactory.Builder extends Object
JsonSchemaFactory| Constructor and Description |
|---|
JsonSchemaFactory.Builder() |
| Modifier and Type | Method and Description |
|---|---|
JsonSchemaFactory.Builder |
addFormats(FormatBundle formatBundle)
Merge the existing bundle with another, custom bundle
|
JsonSchemaFactory.Builder |
addKeywords(KeywordBundle keywordBundle)
Merge the existing keyword bundle with another, custom bundle
|
JsonSchemaFactory.Builder |
addRedirection(String from,
String to)
Add an URI redirection
|
JsonSchemaFactory |
build()
Build the factory
|
JsonSchemaFactory.Builder |
enableFeature(ValidationFeature feature)
Enable a validation feature
|
JsonSchemaFactory.Builder |
registerFormat(String fmt,
FormatAttribute attribute)
Register a format attribute
|
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 |
unregisterFormat(String fmt)
Unregister a format attribute
|
JsonSchemaFactory.Builder |
unregisterKeyword(String name)
Unregister a schema keyword
|
JsonSchemaFactory.Builder |
unregisterScheme(String scheme)
Unregister a scheme
|
JsonSchemaFactory.Builder |
withFormatBundle(FormatBundle formatBundle)
Replace the format bundle with a custom bundle
|
JsonSchemaFactory.Builder |
withKeywordBundle(KeywordBundle keywordBundle)
Replace the keyword bundle with an entirely new bundle
|
public 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 withKeywordBundle(KeywordBundle keywordBundle)
Use with caution!
keywordBundle - the bundlepublic JsonSchemaFactory.Builder addKeywords(KeywordBundle keywordBundle)
keywordBundle - the bundleKeywordBundle.mergeWith(KeywordBundle)public 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 from or to
is an invalid URI, or it is not an absolute JSON ReferenceJsonRefpublic JsonSchemaFactory.Builder enableFeature(ValidationFeature feature)
feature - the feature to setpublic JsonSchemaFactory.Builder registerFormat(String fmt, FormatAttribute attribute)
fmt - the name for this attributeattribute - the format attribute instanceFormatBundle.registerFormat(String, FormatAttribute)public JsonSchemaFactory.Builder unregisterFormat(String fmt)
This is a no op if such a attribute was not registered.
fmt - the name for this attributepublic JsonSchemaFactory.Builder withFormatBundle(FormatBundle formatBundle)
Use with caution! In particular, you should not mess with
uri and regex.
formatBundle - the bundleFormatBundle.defaultBundle()public JsonSchemaFactory.Builder addFormats(FormatBundle formatBundle)
formatBundle - the bundleFormatBundle.mergeWith(FormatBundle)public JsonSchemaFactory build()
Copyright © 2012. All Rights Reserved.