Class AbstractDeserializer<CLASS>
- 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 Object implements IDeserializer<CLASS>
The base class of all format-specific deserializers.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractDeserializer(IAssemblyClassBinding classBinding)Construct a new deserializer.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description IDeserializer<CLASS>applyConfiguration(IConfiguration<DeserializationFeature<?>> other)protected voidconfigurationChanged(IMutableConfiguration<T> config)INodeItemdeserializeToNodeItem(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.IDeserializer<CLASS>disableFeature(DeserializationFeature<?> feature)IDeserializer<CLASS>enableFeature(DeserializationFeature<?> feature)<V> Vget(T feature)protected IBindingContextgetBindingContext()Retrieve the binding context associated with the serializer.protected IAssemblyClassBindinggetClassBinding()Retrieve the bound class information associated with the assembly that the serializer/deserializer will write/read data from.protected IMutableConfiguration<T>getConfiguration()Get the current configuration of the serializer/deserializer.IConstraintValidationHandlergetConstraintValidationHandler()Get the constraint validation handler configured for this deserializer, which will be used to validate loaded data.Map<T,Object>getFeatureValues()booleanisFeatureEnabled(T feature)IDeserializer<CLASS>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, 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, deserializeToValue, isValidating
-
-
-
-
Constructor Detail
-
AbstractDeserializer
protected AbstractDeserializer(@NonNull IAssemblyClassBinding classBinding)
Construct a new deserializer.- Parameters:
classBinding- the bound class information for the Java type this deserializer is operating on
-
-
Method Detail
-
getConstraintValidationHandler
@NonNull public IConstraintValidationHandler getConstraintValidationHandler()
Get the constraint validation handler configured for this deserializer, which will be used to validate loaded data.- Specified by:
getConstraintValidationHandlerin interfaceIDeserializer<CLASS>- 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>- Parameters:
constraintValidationHandler- the handler to use
-
deserializeToNodeItem
public INodeItem deserializeToNodeItem(Reader reader, URI documentUri) throws IOException
Description copied from interface:IDeserializerRead data from theReaderinto a node item instance.- Specified by:
deserializeToNodeItemin interfaceIDeserializer<CLASS>- 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
-
enableFeature
public IDeserializer<CLASS> enableFeature(DeserializationFeature<?> feature)
- Specified by:
enableFeaturein interfaceIDeserializer<CLASS>- Specified by:
enableFeaturein interfaceIMutableConfiguration<CLASS>
-
disableFeature
public IDeserializer<CLASS> disableFeature(DeserializationFeature<?> feature)
- Specified by:
disableFeaturein interfaceIDeserializer<CLASS>- Specified by:
disableFeaturein interfaceIMutableConfiguration<CLASS>
-
applyConfiguration
public IDeserializer<CLASS> applyConfiguration(@NonNull IConfiguration<DeserializationFeature<?>> other)
- Specified by:
applyConfigurationin interfaceIDeserializer<CLASS>- Specified by:
applyConfigurationin interfaceIMutableConfiguration<CLASS>
-
set
public IDeserializer<CLASS> set(DeserializationFeature<?> feature, Object value)
- Specified by:
setin interfaceIDeserializer<CLASS>- Specified by:
setin interfaceIMutableConfiguration<CLASS>
-
getBindingContext
@NonNull protected IBindingContext getBindingContext()
Retrieve the binding context associated with the serializer.- Returns:
- the binding context
-
getClassBinding
@NonNull protected IAssemblyClassBinding getClassBinding()
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<T> config)
-
getConfiguration
@NonNull protected IMutableConfiguration<T> getConfiguration()
Get the current configuration of the serializer/deserializer.- Returns:
- the configuration
-
isFeatureEnabled
public boolean isFeatureEnabled(T feature)
- Specified by:
isFeatureEnabledin interfaceIConfiguration<T extends IConfigurationFeature<?>>
-
getFeatureValues
public Map<T,Object> getFeatureValues()
- Specified by:
getFeatureValuesin interfaceIConfiguration<T extends IConfigurationFeature<?>>
-
get
public <V> V get(T feature)
- Specified by:
getin interfaceIConfiguration<T extends IConfigurationFeature<?>>
-
-