public interface DataSchemaResolver
DataSchemaResolver
is used to resolve names to NamedDataSchema
s.
A SchemaParser
uses existingDataSchema(String)
to determine if a name has already
been resolved to a NamedDataSchema
. The returned NamedDataSchema
may not
be complete or well-formed due to circular references.
A SchemaParser
uses findDataSchema(String, StringBuilder)
to request the
resolving an unresolved name to a NamedDataSchema
. This may be done by searching
jar files or directories for files whose file names computed from the provided name
similar to how Java resolves class names to source or binary files.
The contract between a SchemaParser
and its DataSchemaResolver
requires
the SchemaParser
to invoke bindNameToSchema(Name, NamedDataSchema, DataSchemaLocation)
to bind all possible names (its declared name and aliases) to a newly constructed NamedDataSchema
before SchemaParser
attempts to lookup or resolve names referenced by the NamedDataSchema
.
This means that when the name is bound, the NamedDataSchema
is incomplete. This contract
is required to implement circular references.
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,NamedDataSchema> |
bindings()
Return a map of names to
NamedDataSchema bindings that have been resolved. |
void |
bindNameToSchema(Name name,
NamedDataSchema schema,
DataSchemaLocation location)
Bind name to the provided
NamedDataSchema and DataSchemaLocation . |
NamedDataSchema |
existingDataSchema(java.lang.String name)
Lookup existing
NamedDataSchema with the specified name. |
NamedDataSchema |
findDataSchema(java.lang.String name,
java.lang.StringBuilder errorMessageBuilder)
Find a
NamedDataSchema for the specified name. |
boolean |
locationResolved(DataSchemaLocation location)
Return whether the specified
DataSchemaLocation has been associated with a name. |
java.util.Map<java.lang.String,DataSchemaLocation> |
nameToDataSchemaLocations()
Return a map of names to
DataSchemaLocation s that have been
resolved through this resolver. |
java.util.Map<java.lang.String,NamedDataSchema> bindings()
NamedDataSchema
bindings that have been resolved.NamedDataSchema
bindings that have been resolved.java.util.Map<java.lang.String,DataSchemaLocation> nameToDataSchemaLocations()
DataSchemaLocation
s that have been
resolved through this resolver.DataSchemaLocation
s that have been
resolved through this resolver.NamedDataSchema findDataSchema(java.lang.String name, java.lang.StringBuilder errorMessageBuilder)
NamedDataSchema
for the specified name.
If a NamedDataSchema
with the specified name is not found, the resolver
will should try its best to find and instantiate a NamedDataSchema
with
the specified name.name
- of the schema to find.errorMessageBuilder
- to append error messages to.NamedDataSchema
if it can be located, else return null.void bindNameToSchema(Name name, NamedDataSchema schema, DataSchemaLocation location)
NamedDataSchema
and DataSchemaLocation
.name
- to bind to.schema
- provides the NamedDataSchema
location
- provides the DataSchemaLocation
java.lang.IllegalStateException
- if name is already bound.NamedDataSchema existingDataSchema(java.lang.String name)
NamedDataSchema
with the specified name.
This is a pure lookup operation. If a NamedDataSchema
with the specified
name does not already exist, then this method will return null, else it
returns the existing NamedDataSchema
.name
- of the schema to find.NamedDataSchema
if it already exists, else return null.boolean locationResolved(DataSchemaLocation location)
DataSchemaLocation
has been associated with a name.location
- provides the DataSchemaLocation
to check.DataSchemaLocation
has been associated with a name.