Class DefaultJsonDeserializer<CLASS extends IBoundObject>
java.lang.Object
gov.nist.secauto.metaschema.databind.io.AbstractDeserializer<CLASS>
gov.nist.secauto.metaschema.databind.io.json.DefaultJsonDeserializer<CLASS>
- Type Parameters:
CLASS
- the Java type of the bound object representing the root node to read
- All Implemented Interfaces:
IConfiguration<DeserializationFeature<?>>
,IMutableConfiguration<DeserializationFeature<?>>
,IDeserializer<CLASS>
- Direct Known Subclasses:
DefaultYamlDeserializer
public class DefaultJsonDeserializer<CLASS extends IBoundObject>
extends AbstractDeserializer<CLASS>
Provides support for reading JSON-based data based on a bound Metaschema
module.
-
Constructor Summary
ConstructorDescriptionDefaultJsonDeserializer
(IBoundDefinitionModelAssembly definition) Construct a new JSON deserializer that will parse the bound class identified by theclassBinding
. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected INodeItem
deserializeToNodeItemInternal
(Reader reader, URI documentUri) This abstract method delegates parsing to the concrete implementation.deserializeToValueInternal
(Reader reader, URI documentUri) <V> V
get
(DeserializationFeature<?> feature) protected IBindingContext
Retrieve the binding context associated with the serializer.protected IMutableConfiguration<DeserializationFeature<?>>
Get the current configuration of the serializer/deserializer.protected IBoundDefinitionModelAssembly
Retrieve the bound class information associated with the assembly that the serializer/deserializer will write/read data from.protected com.fasterxml.jackson.core.JsonFactory
Get the parser factory associated with this deserializer.boolean
isFeatureEnabled
(DeserializationFeature<?> feature) protected com.fasterxml.jackson.core.JsonFactory
Get a JSON factory instance.protected final com.fasterxml.jackson.core.JsonParser
newJsonParser
(Reader reader) Using the managed JSON factory, create a new JSON parser instance using the provided reader.protected final void
For use by subclasses to reset the underlying JSON factory when an important change has occurred that will change how the factory produces aJsonParser
.Methods inherited from class gov.nist.secauto.metaschema.databind.io.AbstractDeserializer
applyConfiguration, deserializeToNodeItem, deserializeToValue, disableFeature, enableFeature, getConstraintValidationHandler, set, setConstraintValidationHandler
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.core.configuration.IConfiguration
get, getFeatureValues, isFeatureEnabled
Methods inherited from interface gov.nist.secauto.metaschema.databind.io.IDeserializer
deserialize, deserialize, deserialize, deserialize, deserialize, deserializeToNodeItem, isValidating
-
Constructor Details
-
DefaultJsonDeserializer
Construct a new JSON deserializer that will parse the bound class identified by theclassBinding
.- Parameters:
definition
- the bound class information for the Java type this deserializer is operating on
-
-
Method Details
-
resetFactory
For use by subclasses to reset the underlying JSON factory when an important change has occurred that will change how the factory produces aJsonParser
. -
configurationChanged
-
newFactoryInstance
Get a JSON factory instance.This method can be used by sub-classes to create a customized factory instance.
- Returns:
- the factory
-
getJsonFactory
Get the parser factory associated with this deserializer.- Returns:
- the factory instance
-
newJsonParser
@NonNull protected final com.fasterxml.jackson.core.JsonParser newJsonParser(@NonNull Reader reader) throws IOException Using the managed JSON factory, create a new JSON parser instance using the provided reader.- Parameters:
reader
- the reader for the parser to read data from- Returns:
- the new parser
- Throws:
IOException
- if an error occurred while creating the parser
-
deserializeToNodeItemInternal
protected INodeItem deserializeToNodeItemInternal(@NonNull Reader reader, @NonNull URI documentUri) throws IOException Description copied from class:AbstractDeserializer
This abstract method delegates parsing to the concrete implementation.- Specified by:
deserializeToNodeItemInternal
in classAbstractDeserializer<CLASS extends IBoundObject>
- Parameters:
reader
- the reader instance to read data fromdocumentUri
- the URI of the document that is being read- Returns:
- a new node item containing the read contents
- Throws:
IOException
- if an error occurred while reading data from the stream
-
deserializeToValueInternal
public CLASS deserializeToValueInternal(@NonNull Reader reader, @NonNull URI documentUri) throws IOException - Specified by:
deserializeToValueInternal
in classAbstractDeserializer<CLASS extends IBoundObject>
- Throws:
IOException
-
getBindingContext
Retrieve the binding context associated with the serializer.- Returns:
- the binding context
-
getDefinition
Retrieve the bound class information associated with the assembly that the serializer/deserializer will write/read data from.- Returns:
- the class binding for the Module assembly
-
getConfiguration
Get the current configuration of the serializer/deserializer.- Returns:
- the configuration
-
isFeatureEnabled
- Specified by:
isFeatureEnabled
in interfaceIConfiguration<T extends IConfigurationFeature<?>>
-
getFeatureValues
- Specified by:
getFeatureValues
in interfaceIConfiguration<T extends IConfigurationFeature<?>>
-
get
- Specified by:
get
in interfaceIConfiguration<T extends IConfigurationFeature<?>>
-