Class DefaultBoundLoader
- All Implemented Interfaces:
IConfiguration<DeserializationFeature<?>>
,IMutableConfiguration<DeserializationFeature<?>>
,IDocumentLoader
,IResourceResolver
,IBoundLoader
IBoundLoader
.-
Field Summary
-
Constructor Summary
ConstructorDescriptionDefaultBoundLoader
(IBindingContext bindingContext) Construct a new loader instance, using the providedIBindingContext
. -
Method Summary
Modifier and TypeMethodDescriptionDetermine the format of the provided resource.detectFormat
(URI uri) Determine the format of the resource identified by the provideduri
.@Owning ModelDetector.Result
detectModel
(InputStream is, Format format) Determine the model of the provided resource.Get the configured Module binding context to use to load Java types.boolean
isFeatureEnabled
(DeserializationFeature<?> feature) <CLASS extends IBoundObject>
CLASSload
(InputStream is, URI documentUri) Load data from the provided resource into a bound object.<CLASS extends IBoundObject>
CLASSload
(Class<CLASS> clazz, Format format, InputStream is, URI documentUri) Load data from the specified resource into a bound object with the type of the specified Java class.<CLASS extends IBoundObject>
CLASSload
(Class<CLASS> clazz, InputStream is, URI documentUri) Load data from the specified resource into a bound object with the type of the specified Java class.<CLASS extends IBoundObject>
CLASSLoad data from the specified resource into a bound object with the type of the specified Java class.<CLASS extends IBoundObject>
CLASSLoad data from the resource identified by the provideduri
into a bound object.loadAsNodeItem
(Format format, InputStream is, URI documentUri) Load data expressed using the providedformat
and return that data as a Metapath node item.loadAsNodeItem
(Format format, URI uri) Load data expressed using the providedformat
and return that data as a Metapath node item.loadAsNodeItem
(URI uri) set
(DeserializationFeature<?> feature, Object value) Methods inherited from class gov.nist.secauto.metaschema.core.model.AbstractResourceResolver
getUriResolver, setUriResolver
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface gov.nist.secauto.metaschema.databind.io.IBoundLoader
convert, convert, convert, convert, convert, detectFormat, detectFormat, detectFormat, disableFeature, enableFeature, load, load, load, load, load, load, loadAsNodeItem
Methods inherited from interface gov.nist.secauto.metaschema.core.configuration.IConfiguration
get
Methods inherited from interface gov.nist.secauto.metaschema.core.metapath.IDocumentLoader
loadAsNodeItem, loadAsNodeItem, loadAsNodeItem, setUriResolver
Methods inherited from interface gov.nist.secauto.metaschema.core.model.IResourceResolver
getUriResolver, resolve
-
Field Details
-
LOOK_AHEAD_BYTES
- See Also:
-
-
Constructor Details
-
DefaultBoundLoader
Construct a new loader instance, using the providedIBindingContext
.- Parameters:
bindingContext
- the Module binding context to use to load Java types
-
-
Method Details
-
isFeatureEnabled
- Specified by:
isFeatureEnabled
in interfaceIConfiguration<DeserializationFeature<?>>
-
getFeatureValues
- Specified by:
getFeatureValues
in interfaceIConfiguration<DeserializationFeature<?>>
-
applyConfiguration
- Specified by:
applyConfiguration
in interfaceIBoundLoader
- Specified by:
applyConfiguration
in interfaceIMutableConfiguration<DeserializationFeature<?>>
-
set
- Specified by:
set
in interfaceIBoundLoader
- Specified by:
set
in interfaceIMutableConfiguration<DeserializationFeature<?>>
-
getBindingContext
Description copied from interface:IBoundLoader
Get the configured Module binding context to use to load Java types.- Specified by:
getBindingContext
in interfaceIBoundLoader
- Returns:
- the binding context
-
detectFormat
Description copied from interface:IBoundLoader
Determine the format of the resource identified by the provideduri
.- Specified by:
detectFormat
in interfaceIBoundLoader
- Parameters:
uri
- the resource- Returns:
- the format information for the provided resource
- Throws:
IOException
- if an error occurred while reading the resource
-
detectFormat
Description copied from interface:IBoundLoader
Determine the format of the provided resource.This method will consume data from the provided
InputStream
. If the caller of this method intends to read data from the stream after determining the format, the caller should pass in a stream that can be reset.This method will not close the provided
InputStream
, since it does not own the stream.- Specified by:
detectFormat
in interfaceIBoundLoader
- Parameters:
is
- an input stream for the resource- Returns:
- the format information for the provided resource
- Throws:
IOException
- if an error occurred while reading the resource
-
detectModel
@Owning public @Owning ModelDetector.Result detectModel(@NotOwning InputStream is, Format format) throws IOException Description copied from interface:IBoundLoader
Determine the model of the provided resource.This method will consume data from any
InputStream
provided by theInputSource
. If the caller of this method intends to read data from the stream after determining the format, the caller should pass in a stream that can be reset.This method will not close any
InputStream
provided by theInputSource
, since it does not own the stream.- Specified by:
detectModel
in interfaceIBoundLoader
- Parameters:
is
- an input stream for the resourceformat
- the format of the provided resource- Returns:
- the model of the provided resource
- Throws:
IOException
- if an error occurred while reading the resource
-
load
Description copied from interface:IBoundLoader
Load data from the resource identified by the provideduri
into a bound object.This method will auto-detect the format of the provided resource.
- Specified by:
load
in interfaceIBoundLoader
- Type Parameters:
CLASS
- the type of the bound object to return- Parameters:
uri
- the resource- Returns:
- a bound object containing the loaded data
- Throws:
IOException
- if an error occurred while reading the resource- See Also:
-
load
@NonNull public <CLASS extends IBoundObject> CLASS load(@NotOwning @NonNull InputStream is, @NonNull URI documentUri) throws IOException Description copied from interface:IBoundLoader
Load data from the provided resource into a bound object.This method should auto-detect the format of the provided resource.
This method will not close the provided
InputStream
, since it does not own the stream.- Specified by:
load
in interfaceIBoundLoader
- Type Parameters:
CLASS
- the type of the bound object to return- Parameters:
is
- the resource streamdocumentUri
- the URI of the resource- Returns:
- a bound object containing the loaded data
- Throws:
IOException
- if an error occurred while reading the resource- See Also:
-
load
Description copied from interface:IBoundLoader
Load data from the specified resource into a bound object with the type of the specified Java class.- Specified by:
load
in interfaceIBoundLoader
- Type Parameters:
CLASS
- the Java type to load data into- Parameters:
clazz
- the class for the java typeuri
- the resource to load- Returns:
- the loaded instance data
- Throws:
IOException
- if an error occurred while loading the data in the specified file
-
load
public <CLASS extends IBoundObject> CLASS load(Class<CLASS> clazz, InputStream is, URI documentUri) throws IOException Description copied from interface:IBoundLoader
Load data from the specified resource into a bound object with the type of the specified Java class.This method will not close the provided
InputStream
, since it does not own the stream.Implementations of this method will do format detection. This process might leave the provided
InputStream
at a position beyond the last parsed location. If you want to avoid this possibility, use and implementation ofIDeserializer.deserialize(InputStream, URI)
instead, such as what is provided byDefaultBindingContext.newDeserializer(Format, Class)
.- Specified by:
load
in interfaceIBoundLoader
- Type Parameters:
CLASS
- the Java type to load data into- Parameters:
clazz
- the class for the java typeis
- the resource streamdocumentUri
- the URI of the resource- Returns:
- the loaded data
- Throws:
IOException
- if an error occurred while loading the data from the specified resource
-
load
@NonNull public <CLASS extends IBoundObject> CLASS load(@NonNull Class<CLASS> clazz, @NonNull Format format, @NonNull InputStream is, @NonNull URI documentUri) throws IOException Description copied from interface:IBoundLoader
Load data from the specified resource into a bound object with the type of the specified Java class.This method will not close the provided
InputStream
, since it does not own the stream.- Specified by:
load
in interfaceIBoundLoader
- Type Parameters:
CLASS
- the Java type to load data into- Parameters:
clazz
- the class for the java typeformat
- the format to parseis
- the resource streamdocumentUri
- the URI of the resource- Returns:
- the loaded data
- Throws:
IOException
- if an error occurred while loading the data from the specified resource
-
loadAsNodeItem
- Specified by:
loadAsNodeItem
in interfaceIDocumentLoader
- Throws:
IOException
-
loadAsNodeItem
Description copied from interface:IBoundLoader
Load data expressed using the providedformat
and return that data as a Metapath node item.The specific Module model is auto-detected by analyzing the source. The class reported is implementation specific.
- Specified by:
loadAsNodeItem
in interfaceIBoundLoader
- Parameters:
format
- the expected format of the data to parseuri
- the resource- Returns:
- the Metapath node item for the parsed data
- Throws:
IOException
- if an error occurred while loading the data from the specified resource
-
loadAsNodeItem
public IDocumentNodeItem loadAsNodeItem(Format format, InputStream is, URI documentUri) throws IOException Description copied from interface:IBoundLoader
Load data expressed using the providedformat
and return that data as a Metapath node item.The specific Module model is auto-detected by analyzing the source. The class reported is implementation specific.
- Specified by:
loadAsNodeItem
in interfaceIBoundLoader
- Parameters:
format
- the expected format of the data to parseis
- the resource streamdocumentUri
- the URI of the resource- Returns:
- the Metapath node item for the parsed data
- Throws:
IOException
- if an error occurred while loading the data from the specified resource
-