@ThreadSafe public final class SchemaLoader extends Object
This class is the central loading point for generating a SchemaTree
out of a "raw" JSON Schema (ie, a JsonNode
); it handles
the creation of both anonymous (ie, no loading URI) and non anonymous JSON
schemas.
Depending on your configuration, you may, or may not, be able to use
relative URIs to load your schemas; see URITranslator
and LoadingConfigurationBuilder.setURITranslatorConfiguration(URITranslatorConfiguration)
for more details.
Constructor and Description |
---|
SchemaLoader()
Create a new schema loader with the default loading configuration
|
SchemaLoader(LoadingConfiguration cfg)
Create a new schema loader with a given loading configuration
|
Modifier and Type | Method and Description |
---|---|
SchemaTree |
get(URI uri)
Get a schema tree from the given URI
|
SchemaTree |
load(JsonNode schema)
Create a new tree from a schema
|
String |
toString() |
public SchemaLoader(LoadingConfiguration cfg)
cfg
- the configurationLoadingConfiguration
,
LoadingConfigurationBuilder
public SchemaLoader()
public SchemaTree load(JsonNode schema)
Note that it will always create an "anonymous" tree, that is a tree with an empty loading URI.
schema
- the schemaNullPointerException
- schema is nullDereferencing.newTree(JsonNode)
public SchemaTree get(URI uri) throws ProcessingException
Note that if the URI is relative, it will be resolved against this registry's namespace, if any.
uri
- the URIProcessingException
- URI is not an absolute JSON reference, or
failed to dereference this URINullPointerException
- URI is null