Interface IBoundLoader
-
- All Superinterfaces:
IConfiguration<DeserializationFeature<?>>
,IDocumentLoader
,IMutableConfiguration<DeserializationFeature<?>>
,IResourceLoader
- All Known Implementing Classes:
DefaultBoundLoader
public interface IBoundLoader extends IDocumentLoader, IMutableConfiguration<DeserializationFeature<?>>
A common interface for loading Module based instance resources.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description IBoundLoader
applyConfiguration(IConfiguration<DeserializationFeature<?>> other)
default <CLASS> void
convert(Path source, OutputStream os, Format toFormat, Class<CLASS> rootClass)
Auto convert the providedsource
to the providedtoFormat
.default <CLASS> void
convert(Path source, Path destination, Format toFormat, Class<CLASS> rootClass)
Auto convert the providedsource
to the providedtoFormat
.default FormatDetector.Result
detectFormat(File file)
Determine the format of the provided resource.FormatDetector.Result
detectFormat(InputStream is)
Determine the format of the provided resource.FormatDetector.Result
detectFormat(URI uri)
Determine the format of the resource identified by the provideduri
.default FormatDetector.Result
detectFormat(URL url)
Determine the format of the provided resource.default FormatDetector.Result
detectFormat(Path path)
Determine the format of the provided resource.default IBoundLoader
disableFeature(DeserializationFeature<?> feature)
default IBoundLoader
enableFeature(DeserializationFeature<?> feature)
IBindingContext
getBindingContext()
Get the configured Module binding context to use to load Java types.default <CLASS> CLASS
load(File file)
Load data from the provided resource into a bound object.<CLASS> CLASS
load(InputStream is, URI documentUri)
Load data from the provided resource into a bound object.default <CLASS> CLASS
load(Class<CLASS> clazz, File file)
Load data from the specified resource into a bound object with the type of the specified Java class.<CLASS> CLASS
load(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> CLASS
load(Class<CLASS> clazz, URI uri)
Load data from the specified resource into a bound object with the type of the specified Java class.default <CLASS> CLASS
load(Class<CLASS> clazz, URL url)
Load data from the specified resource into a bound object with the type of the specified Java class.default <CLASS> CLASS
load(Class<CLASS> clazz, Path path)
Load data from the specified resource into a bound object with the type of the specified Java class.<CLASS> CLASS
load(URI uri)
Load data from the resource identified by the provideduri
into a bound object.default <CLASS> CLASS
load(URL url)
Load data from the provided resource into a bound object.default <CLASS> CLASS
load(Path path)
Load data from the provided resource into a bound object.IDocumentNodeItem
loadAsNodeItem(Format format, InputStream is, URI documentUri)
Load data expressed using the providedformat
and return that data as a Metapath node item.IDocumentNodeItem
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.IBoundLoader
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, loadAsNodeItem, setUriResolver
-
Methods inherited from interface gov.nist.secauto.metaschema.core.model.IResourceLoader
getUriResolver
-
-
-
-
Method Detail
-
enableFeature
default IBoundLoader enableFeature(DeserializationFeature<?> feature)
- Specified by:
enableFeature
in interfaceIMutableConfiguration<DeserializationFeature<?>>
-
disableFeature
default IBoundLoader disableFeature(DeserializationFeature<?> feature)
- Specified by:
disableFeature
in interfaceIMutableConfiguration<DeserializationFeature<?>>
-
applyConfiguration
IBoundLoader applyConfiguration(IConfiguration<DeserializationFeature<?>> other)
- Specified by:
applyConfiguration
in interfaceIMutableConfiguration<DeserializationFeature<?>>
-
set
IBoundLoader set(DeserializationFeature<?> feature, Object value)
- Specified by:
set
in interfaceIMutableConfiguration<DeserializationFeature<?>>
-
detectFormat
@NonNull default FormatDetector.Result detectFormat(@NonNull File file) throws IOException
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
@NonNull default FormatDetector.Result detectFormat(@NonNull Path path) throws IOException
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
@NonNull default FormatDetector.Result detectFormat(@NonNull URL url) throws IOException
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
@NonNull FormatDetector.Result detectFormat(@NonNull URI uri) throws IOException
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
@NonNull FormatDetector.Result detectFormat(@NonNull InputStream is) throws IOException
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
-
load
@NonNull default <CLASS> CLASS load(@NonNull File file) throws IOException
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:
detectFormat(File)
-
load
@NonNull default <CLASS> CLASS load(@NonNull Path path) throws IOException
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:
detectFormat(File)
-
load
@NonNull default <CLASS> 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:
detectFormat(URL)
-
load
@NonNull <CLASS> CLASS load(@NonNull URI uri) throws IOException
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:
detectFormat(URL)
-
load
@NonNull <CLASS> 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:
detectFormat(InputStream)
-
load
@NonNull default <CLASS> 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> 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> 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> 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> 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
-
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
@NonNull IBindingContext getBindingContext()
Get the configured Module binding context to use to load Java types.- Returns:
- the binding context
-
convert
default <CLASS> 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> 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
-
-