public abstract class JsonSchemaMap extends ConcurrentHashMap<URI,JsonSchema>
JsonSchema
objects by URI.
Subclasses must implement one of the following methods to load schemas from external sources:
getReader(URI)
- If schemas should be loaded from readers and automatically parsed.
load(URI)
- If you want control over construction of JsonSchema
objects.
ConcurrentHashMap.KeySetView<K,V>
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
JsonSchemaMap() |
Modifier and Type | Method and Description |
---|---|
JsonSchemaMap |
add(JsonSchema... schemas)
Convenience method for pre-populating this map with the specified schemas.
|
JsonSchema |
get(Object uri)
Return the
JsonSchema object at the specified URI. |
Reader |
getReader(URI uri)
Subclasses must implement either this method or
load(URI) to load the schema with the specified URI. |
JsonSchema |
load(URI uri)
Subclasses must implement either this method or
getReader(URI) to load the schema with the specified URI. |
clear, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, forEach, forEach, forEachEntry, forEachEntry, forEachKey, forEachKey, forEachValue, forEachValue, getOrDefault, hashCode, isEmpty, keys, keySet, keySet, mappingCount, merge, newKeySet, newKeySet, put, putAll, putIfAbsent, reduce, reduceEntries, reduceEntries, reduceEntriesToDouble, reduceEntriesToInt, reduceEntriesToLong, reduceKeys, reduceKeys, reduceKeysToDouble, reduceKeysToInt, reduceKeysToLong, reduceToDouble, reduceToInt, reduceToLong, reduceValues, reduceValues, reduceValuesToDouble, reduceValuesToInt, reduceValuesToLong, remove, remove, replace, replace, replaceAll, search, searchEntries, searchKeys, searchValues, size, toString, values
clone
public JsonSchemaMap()
public JsonSchema get(Object uri)
JsonSchema
object at the specified URI.
If this schema object has not been loaded yet, calls load(URI)
.
The value can be of any of the following types: URI
, URL
, String
.
Strings must be valid URIs.
URIs defined by UriResolver
can be used for values.
get
in interface Map<URI,JsonSchema>
get
in class ConcurrentHashMap<URI,JsonSchema>
uri
- The URI of the schema to retrieve.public JsonSchemaMap add(JsonSchema... schemas)
The schemas passed in through this method MUST have their ID properties set.
schemas
- The set of schemas to add to this map.RuntimeException
- If one or more schema objects did not have their ID property set.public JsonSchema load(URI uri)
getReader(URI)
to load the schema with the specified URI.
It's up to the implementer to decide where these come from.
The default implementation calls getReader(URI)
and parses the schema document.
If getReader(URI)
returns
uri
- The URI to load the schema from.public Reader getReader(URI uri)
load(URI)
to load the schema with the specified URI.
It's up to the implementer to decide where these come from.
The default implementation returns
uri
- The URI to connect to and retrieve the contents.Copyright © 2018 Apache. All rights reserved.