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
ConstructorsModifierConstructorDescriptionprotectedAbstractDeserializer(IBoundDefinitionModelAssembly definition) Construct a new deserializer. -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddeserializeToNodeItem(Reader reader, URI documentUri) Read data from theReaderinto a node item instance.protected abstract INodeItemdeserializeToNodeItemInternal(Reader reader, URI documentUri) This abstract method delegates parsing to the concrete implementation.final CLASSdeserializeToValue(Reader reader, URI documentUri) Read data from theReaderinto a node item instance.protected abstract CLASSdeserializeToValueInternal(Reader reader, URI documentUri) disableFeature(DeserializationFeature<?> feature) enableFeature(DeserializationFeature<?> feature) <V> Vget(DeserializationFeature<?> feature) protected IBindingContextRetrieve 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 IBoundDefinitionModelAssemblyRetrieve the bound class information associated with the assembly that the serializer/deserializer will write/read data from.booleanisFeatureEnabled(DeserializationFeature<?> feature) set(DeserializationFeature<?> feature, Object value) voidsetConstraintValidationHandler(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, waitMethods inherited from interface gov.nist.secauto.metaschema.core.configuration.IConfiguration
get, getFeatureValues, isFeatureEnabledMethods 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:
getConstraintValidationHandlerin interfaceIDeserializer<CLASS extends IBoundObject>- Returns:
- the deserializer
-
setConstraintValidationHandler
public void setConstraintValidationHandler(@NonNull IConstraintValidationHandler constraintValidationHandler) Description copied from interface:IDeserializerSet the constraint violation handler for constraint validation.- Specified by:
setConstraintValidationHandlerin interfaceIDeserializer<CLASS extends IBoundObject>- Parameters:
constraintValidationHandler- the handler to use
-
deserializeToNodeItem
Description copied from interface:IDeserializerRead data from theReaderinto a node item instance.- Specified by:
deserializeToNodeItemin 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:IDeserializerRead data from theReaderinto a node item instance.- Specified by:
deserializeToValuein 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:
enableFeaturein interfaceIDeserializer<CLASS extends IBoundObject>- Specified by:
enableFeaturein interfaceIMutableConfiguration<CLASS extends IBoundObject>
-
disableFeature
- Specified by:
disableFeaturein interfaceIDeserializer<CLASS extends IBoundObject>- Specified by:
disableFeaturein interfaceIMutableConfiguration<CLASS extends IBoundObject>
-
applyConfiguration
public IDeserializer<CLASS> applyConfiguration(@NonNull IConfiguration<DeserializationFeature<?>> other) - Specified by:
applyConfigurationin interfaceIDeserializer<CLASS extends IBoundObject>- Specified by:
applyConfigurationin interfaceIMutableConfiguration<CLASS extends IBoundObject>
-
set
- Specified by:
setin interfaceIDeserializer<CLASS extends IBoundObject>- Specified by:
setin 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:
isFeatureEnabledin interfaceIConfiguration<T extends IConfigurationFeature<?>>
-
getFeatureValues
- Specified by:
getFeatureValuesin interfaceIConfiguration<T extends IConfigurationFeature<?>>
-
get
- Specified by:
getin interfaceIConfiguration<T extends IConfigurationFeature<?>>
-