@ParametersAreNonnullByDefault public abstract class SchemaKey extends Object
This package offers two ways to load a schema: either directly (that is,
from a JsonNode
) or via a URI. The implementation considers that
schemas loaded via the first mechanism are anonymous (that is, they have no
associated URI).
Depending on which of the two ways above you use, a SchemaTree
will be identified either by an AnonymousSchemaKey
(using anonymousKey()
) or a JsonRefSchemaKey
(using forJsonRef(JsonRef)
).
Modifier and Type | Field and Description |
---|---|
protected JsonRef |
loadingRef |
Modifier | Constructor and Description |
---|---|
protected |
SchemaKey(JsonRef loadingRef) |
Modifier and Type | Method and Description |
---|---|
static SchemaKey |
anonymousKey()
Generate an anonymous key for a
SchemaTree |
abstract boolean |
equals(Object obj) |
static SchemaKey |
forJsonRef(JsonRef ref)
Generate a key for a schema loaded from a
JSON Reference |
abstract long |
getId()
Get the identifier, as a long, for this schema -- DO NOT USE DIRECTLY
|
JsonRef |
getLoadingRef()
Get the loading URI (as a
JSON Reference ) for that key |
abstract int |
hashCode() |
abstract String |
toString() |
protected final JsonRef loadingRef
protected SchemaKey(JsonRef loadingRef)
public static SchemaKey anonymousKey()
SchemaTree
The key is uniquely identified by a long
identifier; values
are picked from an AtomicLong
.
Note: this means that two identical JSON Schemas loaded anonymously at different points in time (or different threads) will not be considered equal.
public static SchemaKey forJsonRef(@Untainted JsonRef ref)
JSON Reference
ref
- the JSON ReferenceURIDownloader
public abstract long getId()
Important: this method is here only for backwards
compatibility reasons (see SchemaTree.getId()
); you should not
be using it as a reliable identifier, since for all non anonymous
schema keys (ie, instances of JsonRefSchemaKey
), this will return
0L
.
public final JsonRef getLoadingRef()
JSON Reference
) for that key
Important: this method only works reliably for non
anonymous schemas; for anonymous schemas, it will always return JsonRef.emptyRef()
. As such, you should not use it directly.