Interface IBoundLoader
- All Superinterfaces:
IConfiguration<DeserializationFeature<?>>
,IDocumentLoader
,IMutableConfiguration<DeserializationFeature<?>>
,IResourceResolver
- All Known Implementing Classes:
DefaultBoundLoader
-
Method Summary
Modifier and TypeMethodDescriptiondefault <CLASS extends IBoundObject>
voidconvert
(URI source, OutputStream os, Format toFormat, Class<CLASS> rootClass) Auto convert the providedsource
to the providedtoFormat
.default <CLASS extends IBoundObject>
voidAuto convert the providedsource
to the providedtoFormat
.default <CLASS extends IBoundObject>
voidAuto convert the providedsource
to the providedtoFormat
.default <CLASS extends IBoundObject>
voidconvert
(Path source, OutputStream os, Format toFormat, Class<CLASS> rootClass) Auto convert the providedsource
to the providedtoFormat
.default <CLASS extends IBoundObject>
voidAuto convert the providedsource
to the providedtoFormat
.default Format
detectFormat
(File file) Determine the format of the provided resource.Determine the format of the provided resource.detectFormat
(URI uri) Determine the format of the resource identified by the provideduri
.default Format
detectFormat
(URL url) Determine the format of the provided resource.default Format
detectFormat
(Path path) Determine the format of the provided resource.detectModel
(InputStream is, Format format) Determine the model of the provided resource.default IBoundLoader
disableFeature
(DeserializationFeature<?> feature) default IBoundLoader
enableFeature
(DeserializationFeature<?> feature) Get the configured Module binding context to use to load Java types.default <CLASS extends IBoundObject>
CLASSLoad data from the provided resource into a bound object.<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.default <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
(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.default <CLASS extends IBoundObject>
CLASSLoad data from the specified resource into a bound object with the type of the specified Java class.default <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.default <CLASS extends IBoundObject>
CLASSLoad data from the provided resource into a bound object.default <CLASS extends IBoundObject>
CLASSLoad data from the provided resource 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.default IDocumentNodeItem
loadAsNodeItem
(Format format, Path path) Load data expressed using the providedformat
and return that data as a Metapath node item.set
(DeserializationFeature<?> feature, Object value) Methods inherited from interface gov.nist.secauto.metaschema.core.configuration.IConfiguration
get, getFeatureValues, isFeatureEnabled
Methods inherited from interface gov.nist.secauto.metaschema.core.metapath.IDocumentLoader
loadAsNodeItem, loadAsNodeItem, loadAsNodeItem, loadAsNodeItem, setUriResolver
Methods inherited from interface gov.nist.secauto.metaschema.core.model.IResourceResolver
getUriResolver, resolve
-
Method Details
-
enableFeature
- Specified by:
enableFeature
in interfaceIMutableConfiguration<DeserializationFeature<?>>
-
disableFeature
- Specified by:
disableFeature
in interfaceIMutableConfiguration<DeserializationFeature<?>>
-
applyConfiguration
- Specified by:
applyConfiguration
in interfaceIMutableConfiguration<DeserializationFeature<?>>
-
set
- Specified by:
set
in interfaceIMutableConfiguration<DeserializationFeature<?>>
-
detectFormat
Determine the format of the provided resource.- Parameters:
file
- the resource- Returns:
- the format information for the provided resource
- Throws:
IOException
- if an error occurred while reading the resource
-
detectFormat
Determine the format of the provided resource.- Parameters:
path
- the resource- Returns:
- the format information for the provided resource
- Throws:
IOException
- if an error occurred while reading the resource
-
detectFormat
Determine the format of the provided resource.- Parameters:
url
- the resource- Returns:
- the format information for the provided resource
- Throws:
IOException
- if an error occurred while reading the resource
-
detectFormat
Determine the format of the resource identified by the provideduri
.- Parameters:
uri
- the resource- Returns:
- the format information for the provided resource
- Throws:
IOException
- if an error occurred while reading the resource
-
detectFormat
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.- 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
@NonNull @Owning ModelDetector.Result detectModel(@NonNull InputStream is, @NonNull Format format) throws IOException 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.- 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
Load data from the provided resource into a bound object.This method will auto-detect the format of the provided resource.
- Type Parameters:
CLASS
- the type of the bound object to return- Parameters:
file
- the resource- Returns:
- a bound object containing the loaded data
- Throws:
IOException
- if an error occurred while reading the resource- See Also:
-
load
Load data from the provided resource into a bound object.This method will auto-detect the format of the provided resource.
- Type Parameters:
CLASS
- the type of the bound object to return- Parameters:
path
- the resource- Returns:
- a bound object containing the loaded data
- Throws:
IOException
- if an error occurred while reading the resource- See Also:
-
load
@NonNull default <CLASS extends IBoundObject> CLASS load(@NonNull URL url) throws IOException, URISyntaxException Load data from the provided resource into a bound object.This method will auto-detect the format of the provided resource.
- Type Parameters:
CLASS
- the type of the bound object to return- Parameters:
url
- the resource- Returns:
- a bound object containing the loaded data
- Throws:
IOException
- if an error occurred while reading the resourceURISyntaxException
- if the providedurl
is malformed- See Also:
-
load
Load data from the resource identified by the provideduri
into a bound object.This method will auto-detect the format of the provided resource.
- 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 <CLASS extends IBoundObject> CLASS load(@NonNull InputStream is, @NonNull URI documentUri) throws IOException 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.- 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
@NonNull default <CLASS extends IBoundObject> CLASS load(@NonNull Class<CLASS> clazz, @NonNull File file) throws IOException Load data from the specified resource into a bound object with the type of the specified Java class.- Type Parameters:
CLASS
- the Java type to load data into- Parameters:
clazz
- the class for the java typefile
- the resource to load- Returns:
- the loaded instance data
- Throws:
IOException
- if an error occurred while loading the data in the specified file
-
load
@NonNull default <CLASS extends IBoundObject> CLASS load(@NonNull Class<CLASS> clazz, @NonNull Path path) throws IOException Load data from the specified resource into a bound object with the type of the specified Java class.- Type Parameters:
CLASS
- the Java type to load data into- Parameters:
clazz
- the class for the java typepath
- the resource to load- Returns:
- the loaded instance data
- Throws:
IOException
- if an error occurred while loading the data in the specified file
-
load
@NonNull default <CLASS extends IBoundObject> CLASS load(@NonNull Class<CLASS> clazz, @NonNull URL url) throws IOException, URISyntaxException Load data from the specified resource into a bound object with the type of the specified Java class.- Type Parameters:
CLASS
- the Java type to load data into- Parameters:
clazz
- the class for the java typeurl
- the resource to load- Returns:
- the loaded instance data
- Throws:
IOException
- if an error occurred while loading the data in the specified fileURISyntaxException
- if the providedurl
is malformed
-
load
@NonNull <CLASS extends IBoundObject> CLASS load(@NonNull Class<CLASS> clazz, @NonNull URI uri) throws IOException Load data from the specified resource into a bound object with the type of the specified Java class.- 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
@NonNull <CLASS extends IBoundObject> CLASS load(@NonNull Class<CLASS> clazz, @NonNull InputStream is, @NonNull URI documentUri) throws IOException 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)
.- 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 <CLASS extends IBoundObject> CLASS load(@NonNull Class<CLASS> clazz, @NonNull Format format, @NonNull InputStream is, @NonNull URI documentUri) throws IOException 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.- Type Parameters:
CLASS
- the Java type to load data into- Parameters:
format
- the format to parseclazz
- 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
-
loadAsNodeItem
@NonNull default IDocumentNodeItem loadAsNodeItem(@NonNull Format format, @NonNull Path path) throws IOException 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.
- Parameters:
format
- the expected format of the data to parsepath
- 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
@NonNull IDocumentNodeItem loadAsNodeItem(@NonNull Format format, @NonNull URI uri) throws IOException 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.
- 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
@NonNull IDocumentNodeItem loadAsNodeItem(@NonNull Format format, @NonNull InputStream is, @NonNull URI documentUri) throws IOException 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.
- 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
-
getBindingContext
Get the configured Module binding context to use to load Java types.- Returns:
- the binding context
-
convert
default <CLASS extends IBoundObject> void convert(@NonNull Path source, @NonNull Path destination, @NonNull Format toFormat, @NonNull Class<CLASS> rootClass) throws FileNotFoundException, IOException Auto convert the providedsource
to the providedtoFormat
. Write the converted content to the provideddestination
.The format of the source is expected to be auto detected using
detectFormat(Path)
.- Type Parameters:
CLASS
- the Java type to load data into- Parameters:
source
- the resource to convertdestination
- the resource to write converted content totoFormat
- the format to convert torootClass
- the class for the Java type to load data into- Throws:
FileNotFoundException
- the the provided source file was not foundIOException
- if an error occurred while loading the data from the specified resource or writing the converted data to the specified destination
-
convert
default <CLASS extends IBoundObject> void convert(@NonNull Path source, @NonNull OutputStream os, @NonNull Format toFormat, @NonNull Class<CLASS> rootClass) throws FileNotFoundException, IOException Auto convert the providedsource
to the providedtoFormat
. Write the converted content to the provideddestination
.The format of the source is expected to be auto detected using
detectFormat(Path)
.- Type Parameters:
CLASS
- the Java type to load data into- Parameters:
source
- the resource to convertos
- the output stream to write converted content totoFormat
- the format to convert torootClass
- the class for the Java type to load data into- Throws:
FileNotFoundException
- the the provided source file was not foundIOException
- if an error occurred while loading the data from the specified resource or writing the converted data to the specified destination
-
convert
default <CLASS extends IBoundObject> void convert(@NonNull URI source, @NonNull Path destination, @NonNull Format toFormat, @NonNull Class<CLASS> rootClass) throws FileNotFoundException, IOException Auto convert the providedsource
to the providedtoFormat
. Write the converted content to the provideddestination
.The format of the source is expected to be auto detected using
detectFormat(Path)
.- Type Parameters:
CLASS
- the Java type to load data into- Parameters:
source
- the resource to convertdestination
- the resource to write converted content totoFormat
- the format to convert torootClass
- the class for the Java type to load data into- Throws:
FileNotFoundException
- the the provided source file was not foundIOException
- if an error occurred while loading the data from the specified resource or writing the converted data to the specified destination
-
convert
default <CLASS extends IBoundObject> void convert(@NonNull URI source, @NonNull OutputStream os, @NonNull Format toFormat, @NonNull Class<CLASS> rootClass) throws FileNotFoundException, IOException Auto convert the providedsource
to the providedtoFormat
. Write the converted content to the provideddestination
.The format of the source is expected to be auto detected using
detectFormat(Path)
.- Type Parameters:
CLASS
- the Java type to load data into- Parameters:
source
- the resource to convertos
- the output stream to write converted content totoFormat
- the format to convert torootClass
- the class for the Java type to load data into- Throws:
FileNotFoundException
- the the provided source file was not foundIOException
- if an error occurred while loading the data from the specified resource or writing the converted data to the specified destination
-
convert
default <CLASS extends IBoundObject> void convert(@NonNull URI source, @NonNull Writer writer, @NonNull Format toFormat, @NonNull Class<CLASS> rootClass) throws FileNotFoundException, IOException Auto convert the providedsource
to the providedtoFormat
. Write the converted content to the provideddestination
.The format of the source is expected to be auto detected using
detectFormat(Path)
.- Type Parameters:
CLASS
- the Java type to load data into- Parameters:
source
- the resource to convertwriter
- the writer to write converted content totoFormat
- the format to convert torootClass
- the class for the Java type to load data into- Throws:
FileNotFoundException
- the the provided source file was not foundIOException
- if an error occurred while loading the data from the specified resource or writing the converted data to the specified destination
-