Class DefaultBoundLoader
- All Implemented Interfaces:
IConfiguration<DeserializationFeature<?>>,IMutableConfiguration<DeserializationFeature<?>>,IDocumentLoader,IResourceResolver,IBoundLoader
IBoundLoader.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe number of bytes to read ahead when determining the source format. -
Constructor Summary
ConstructorsConstructorDescriptionDefaultBoundLoader(IBindingContext bindingContext) Construct a new loader instance, using the providedIBindingContext. -
Method Summary
Modifier and TypeMethodDescriptiondetectFormat(InputStream is, URI resource) Determine the format of the provided resource.detectFormat(URI uri) Determine the format of the resource identified by the provideduri.@Owning ModelDetector.ResultdetectModel(InputStream is, URI resource, Format format) Determine the model of the provided resource.Get the configured Module binding context to use to load Java types.booleanisFeatureEnabled(DeserializationFeature<?> feature) <CLASS extends IBoundObject>
CLASSload(InputStream is, URI resource) 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 provideduriinto a bound object.loadAsNodeItem(Format format, InputStream is, URI resource) Load data expressed using the providedformatand return that data as a Metapath node item.loadAsNodeItem(Format format, URI uri) Load data expressed using the providedformatand 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, setUriResolverMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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, loadAsNodeItemMethods inherited from interface gov.nist.secauto.metaschema.core.configuration.IConfiguration
getMethods inherited from interface gov.nist.secauto.metaschema.core.metapath.IDocumentLoader
loadAsNodeItem, loadAsNodeItem, loadAsNodeItem, setUriResolverMethods inherited from interface gov.nist.secauto.metaschema.core.model.IResourceResolver
getUriResolver, resolve
-
Field Details
-
LOOK_AHEAD_BYTES
The number of bytes to read ahead when determining the source format.- 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:
isFeatureEnabledin interfaceIConfiguration<DeserializationFeature<?>>
-
getFeatureValues
- Specified by:
getFeatureValuesin interfaceIConfiguration<DeserializationFeature<?>>
-
applyConfiguration
- Specified by:
applyConfigurationin interfaceIBoundLoader- Specified by:
applyConfigurationin interfaceIMutableConfiguration<DeserializationFeature<?>>
-
set
- Specified by:
setin interfaceIBoundLoader- Specified by:
setin interfaceIMutableConfiguration<DeserializationFeature<?>>
-
getBindingContext
Description copied from interface:IBoundLoaderGet the configured Module binding context to use to load Java types.- Specified by:
getBindingContextin interfaceIBoundLoader- Returns:
- the binding context
-
detectFormat
Description copied from interface:IBoundLoaderDetermine the format of the resource identified by the provideduri.- Specified by:
detectFormatin 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:IBoundLoaderDetermine 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:
detectFormatin interfaceIBoundLoader- Parameters:
is- an input stream for the resourceresource- the URI of 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, URI resource, Format format) throws IOException Description copied from interface:IBoundLoaderDetermine the model of the provided resource.This method will consume data from any
InputStreamprovided 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
InputStreamprovided by theInputSource, since it does not own the stream.- Specified by:
detectModelin interfaceIBoundLoader- Parameters:
is- an input stream for the resourceresource- the URI of 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:IBoundLoaderLoad data from the resource identified by the provideduriinto a bound object.This method will auto-detect the format of the provided resource.
- Specified by:
loadin 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 resource) throws IOException Description copied from interface:IBoundLoaderLoad 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:
loadin interfaceIBoundLoader- Type Parameters:
CLASS- the type of the bound object to return- Parameters:
is- the resource streamresource- 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:IBoundLoaderLoad data from the specified resource into a bound object with the type of the specified Java class.- Specified by:
loadin 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:IBoundLoaderLoad 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
InputStreamat 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:
loadin 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:IBoundLoaderLoad 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:
loadin 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:
loadAsNodeItemin interfaceIDocumentLoader- Throws:
IOException
-
loadAsNodeItem
Description copied from interface:IBoundLoaderLoad data expressed using the providedformatand 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:
loadAsNodeItemin 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 resource) throws IOException Description copied from interface:IBoundLoaderLoad data expressed using the providedformatand 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:
loadAsNodeItemin interfaceIBoundLoader- Parameters:
format- the expected format of the data to parseis- the resource streamresource- 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
-