public static final class JsonSchemaValidator.Builder extends Object
JsonSchemaValidator
.
This builder can be safely reused, returning a different
instance each time build()
is invoked.
It is mandatory to invoke setSchemaLocation(String)
with a valid value before
attempting to build()
an instanceModifier and Type | Method and Description |
---|---|
JsonSchemaValidator.Builder |
addSchemaRedirect(String from,
String to)
Allows to redirect any given URI in the Schema (or even the schema location itself)
to any other specific URI.
|
JsonSchemaValidator.Builder |
addSchemaRedirects(Map<String,String> redirects)
Allows adding many redirects following the same rules as
addSchemaRedirect(String, String) |
JsonSchemaValidator |
build()
Builds a new instance per the given configuration.
|
JsonSchemaValidator.Builder |
setDereferencing(JsonSchemaDereferencing dereferencing)
Sets the dereferencing mode to be used.
|
JsonSchemaValidator.Builder |
setSchemaLocation(String schemaLocation)
A location in which the json schema is present.
|
public JsonSchemaValidator.Builder setSchemaLocation(String schemaLocation)
schemaLocation
- the location of the schema to validate againstIllegalArgumentException
- if schemaLocation
is blank or null
public JsonSchemaValidator.Builder setDereferencing(JsonSchemaDereferencing dereferencing)
JsonSchemaDereferencing.CANONICAL
dereferencing
- a dereferencing modeIllegalArgumentException
- if dereferencing
is null
public JsonSchemaValidator.Builder addSchemaRedirect(String from, String to)
from
- the location to redirect. Accepts the same formats as setSchemaLocation(String)
to
- the location to redirect to. Accepts the same formats as setSchemaLocation(String)
IllegalArgumentException
- if from
or to
are blank or null
public JsonSchemaValidator.Builder addSchemaRedirects(Map<String,String> redirects)
addSchemaRedirect(String, String)
redirects
- a Map
with redirectionsIllegalArgumentException
- if redirects
is null
public JsonSchemaValidator build()
JsonSchemaValidator
IllegalStateException
- if setSchemaLocation(String)
was not invokedCopyright © 2003–2015 MuleSoft, Inc.. All rights reserved.