public final class SchemaRegistry extends Object
All schema registering and downloading is done through this class.
Note that if the id of a schema is not absolute (that is, the URI itself is absolute and it has no fragment part, or an empty fragment), then the whole schema will be considered anonymous.
This class is thread safe.
| Modifier and Type | Field and Description |
|---|---|
private LoadingCache<URI,SchemaContainer> |
cache
Schema cache
|
private URI |
namespace
The default namespace
|
| Constructor and Description |
|---|
SchemaRegistry(URIManager manager,
URI namespace)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
SchemaContainer |
get(URI uri)
Get a schema container from the given URI
|
SchemaContainer |
register(JsonNode schema)
Register a schema
|
private final URI namespace
private final LoadingCache<URI,SchemaContainer> cache
public SchemaRegistry(URIManager manager, URI namespace)
manager - the URI manager to usenamespace - this registry's namespacepublic SchemaContainer register(JsonNode schema)
schema - the schema to registerpublic SchemaContainer get(URI uri) throws JsonSchemaException
Note that if the URI is relative, it will be resolved against this registry's namespace, if any.
uri - the URIJsonSchemaException - impossible to get content at this URICopyright © 2012. All Rights Reserved.