Class AbstractDeserializer<CLASS extends IBoundObject>
java.lang.Object
gov.nist.secauto.metaschema.databind.io.AbstractDeserializer<CLASS>
- Type Parameters:
CLASS
- the bound class to deserialize to
- All Implemented Interfaces:
IConfiguration<DeserializationFeature<?>>
,IMutableConfiguration<DeserializationFeature<?>>
,IDeserializer<CLASS>
- Direct Known Subclasses:
DefaultJsonDeserializer
,DefaultXmlDeserializer
public abstract class AbstractDeserializer<CLASS extends IBoundObject>
extends Object
implements IDeserializer<CLASS>
The base class of all format-specific deserializers.
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractDeserializer
(IBoundDefinitionModelAssembly definition) Construct a new deserializer. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
deserializeToNodeItem
(Reader reader, URI documentUri) Read data from theReader
into a node item instance.protected abstract INodeItem
deserializeToNodeItemInternal
(Reader reader, URI documentUri) This abstract method delegates parsing to the concrete implementation.final CLASS
deserializeToValue
(Reader reader, URI documentUri) Read data from theReader
into a node item instance.protected abstract CLASS
deserializeToValueInternal
(Reader reader, URI documentUri) disableFeature
(DeserializationFeature<?> feature) enableFeature
(DeserializationFeature<?> feature) <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.Get the constraint validation handler configured for this deserializer, which will be used to validate loaded data.protected IBoundDefinitionModelAssembly
Retrieve the bound class information associated with the assembly that the serializer/deserializer will write/read data from.boolean
isFeatureEnabled
(DeserializationFeature<?> feature) set
(DeserializationFeature<?> feature, Object value) void
setConstraintValidationHandler
(IConstraintValidationHandler constraintValidationHandler) Set the constraint violation handler for constraint validation.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
-
AbstractDeserializer
Construct a new deserializer.- Parameters:
definition
- the bound class information for the Java type this deserializer is operating on
-
-
Method Details
-
getConstraintValidationHandler
Get the constraint validation handler configured for this deserializer, which will be used to validate loaded data.- Specified by:
getConstraintValidationHandler
in interfaceIDeserializer<CLASS extends IBoundObject>
- Returns:
- the deserializer
-
setConstraintValidationHandler
public void setConstraintValidationHandler(@NonNull IConstraintValidationHandler constraintValidationHandler) Description copied from interface:IDeserializer
Set the constraint violation handler for constraint validation.- Specified by:
setConstraintValidationHandler
in interfaceIDeserializer<CLASS extends IBoundObject>
- Parameters:
constraintValidationHandler
- the handler to use
-
deserializeToNodeItem
Description copied from interface:IDeserializer
Read data from theReader
into a node item instance.- Specified by:
deserializeToNodeItem
in interfaceIDeserializer<CLASS extends IBoundObject>
- Parameters:
reader
- the reader to read fromdocumentUri
- the URI of the document to read from- Returns:
- a new node item
- Throws:
IOException
- if an error occurred while reading data from the stream
-
deserializeToNodeItemInternal
@NonNull protected abstract INodeItem deserializeToNodeItemInternal(@NonNull Reader reader, @NonNull URI documentUri) throws IOException This abstract method delegates parsing to the concrete implementation.- 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
-
deserializeToValue
Description copied from interface:IDeserializer
Read data from theReader
into a node item instance.- Specified by:
deserializeToValue
in interfaceIDeserializer<CLASS extends IBoundObject>
- Parameters:
reader
- the reader to read fromdocumentUri
- the URI of the document to read from- Returns:
- a new node item
- Throws:
IOException
- if an error occurred while reading data from the stream
-
deserializeToValueInternal
@NonNull protected abstract CLASS deserializeToValueInternal(@NonNull Reader reader, @NonNull URI documentUri) throws IOException - Throws:
IOException
-
enableFeature
- Specified by:
enableFeature
in interfaceIDeserializer<CLASS extends IBoundObject>
- Specified by:
enableFeature
in interfaceIMutableConfiguration<CLASS extends IBoundObject>
-
disableFeature
- Specified by:
disableFeature
in interfaceIDeserializer<CLASS extends IBoundObject>
- Specified by:
disableFeature
in interfaceIMutableConfiguration<CLASS extends IBoundObject>
-
applyConfiguration
public IDeserializer<CLASS> applyConfiguration(@NonNull IConfiguration<DeserializationFeature<?>> other) - Specified by:
applyConfiguration
in interfaceIDeserializer<CLASS extends IBoundObject>
- Specified by:
applyConfiguration
in interfaceIMutableConfiguration<CLASS extends IBoundObject>
-
set
- Specified by:
set
in interfaceIDeserializer<CLASS extends IBoundObject>
- Specified by:
set
in interfaceIMutableConfiguration<CLASS extends IBoundObject>
-
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
-
configurationChanged
protected void configurationChanged(@NonNull IMutableConfiguration<DeserializationFeature<?>> config) -
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<?>>
-