Module dev.metaschema.databind
Package dev.metaschema.databind.io
Class AbstractDeserializer<CLASS extends dev.metaschema.core.model.IBoundObject>
java.lang.Object
dev.metaschema.databind.io.AbstractDeserializer<CLASS>
- Type Parameters:
CLASS- the bound class to deserialize to
- All Implemented Interfaces:
dev.metaschema.core.configuration.IConfiguration<DeserializationFeature<?>>,dev.metaschema.core.configuration.IMutableConfiguration<DeserializationFeature<?>>,IDeserializer<CLASS>
- Direct Known Subclasses:
DefaultJsonDeserializer,DefaultXmlDeserializer
public abstract class AbstractDeserializer<CLASS extends dev.metaschema.core.model.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 TypeMethodDescriptionapplyConfiguration(dev.metaschema.core.configuration.IConfiguration<DeserializationFeature<?>> other) protected voidconfigurationChanged(dev.metaschema.core.configuration.IMutableConfiguration<DeserializationFeature<?>> config) Callback method invoked when the configuration has been changed.dev.metaschema.core.metapath.item.node.INodeItemdeserializeToNodeItem(Reader reader, URI documentUri) Read data from theReaderinto a node item instance.protected abstract dev.metaschema.core.metapath.item.node.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) This abstract method delegates parsing to the concrete implementation, returning the deserialized value directly.disableFeature(DeserializationFeature<?> feature) enableFeature(DeserializationFeature<?> feature) <V> Vget(DeserializationFeature<?> feature) protected IBindingContextRetrieve the binding context associated with the serializer.protected dev.metaschema.core.configuration.IMutableConfiguration<DeserializationFeature<?>>Get the current configuration of the serializer/deserializer.dev.metaschema.core.model.constraint.IConstraintValidationHandlerGet 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(dev.metaschema.core.model.constraint.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 dev.metaschema.core.configuration.IConfiguration
get, getFeatureValues, isFeatureEnabledMethods inherited from interface dev.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
@NonNull public dev.metaschema.core.model.constraint.IConstraintValidationHandler getConstraintValidationHandler()Get the constraint validation handler configured for this deserializer, which will be used to validate loaded data.- Specified by:
getConstraintValidationHandlerin interfaceIDeserializer<CLASS extends dev.metaschema.core.model.IBoundObject>- Returns:
- the deserializer
-
setConstraintValidationHandler
public void setConstraintValidationHandler(@NonNull dev.metaschema.core.model.constraint.IConstraintValidationHandler constraintValidationHandler) Description copied from interface:IDeserializerSet the constraint violation handler for constraint validation.- Specified by:
setConstraintValidationHandlerin interfaceIDeserializer<CLASS extends dev.metaschema.core.model.IBoundObject>- Parameters:
constraintValidationHandler- the handler to use
-
deserializeToNodeItem
public dev.metaschema.core.metapath.item.node.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 extends dev.metaschema.core.model.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 dev.metaschema.core.metapath.item.node.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 dev.metaschema.core.model.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 This abstract method delegates parsing to the concrete implementation, returning the deserialized value directly.- Parameters:
reader- the reader instance to read data fromdocumentUri- the URI of the document that is being read- Returns:
- the deserialized object
- Throws:
IOException- if an error occurred while reading data from the stream
-
enableFeature
- Specified by:
enableFeaturein interfaceIDeserializer<CLASS extends dev.metaschema.core.model.IBoundObject>- Specified by:
enableFeaturein interfacedev.metaschema.core.configuration.IMutableConfiguration<CLASS extends dev.metaschema.core.model.IBoundObject>
-
disableFeature
- Specified by:
disableFeaturein interfaceIDeserializer<CLASS extends dev.metaschema.core.model.IBoundObject>- Specified by:
disableFeaturein interfacedev.metaschema.core.configuration.IMutableConfiguration<CLASS extends dev.metaschema.core.model.IBoundObject>
-
applyConfiguration
public IDeserializer<CLASS> applyConfiguration(@NonNull dev.metaschema.core.configuration.IConfiguration<DeserializationFeature<?>> other) - Specified by:
applyConfigurationin interfaceIDeserializer<CLASS extends dev.metaschema.core.model.IBoundObject>- Specified by:
applyConfigurationin interfacedev.metaschema.core.configuration.IMutableConfiguration<CLASS extends dev.metaschema.core.model.IBoundObject>
-
set
- Specified by:
setin interfaceIDeserializer<CLASS extends dev.metaschema.core.model.IBoundObject>- Specified by:
setin interfacedev.metaschema.core.configuration.IMutableConfiguration<CLASS extends dev.metaschema.core.model.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 dev.metaschema.core.configuration.IMutableConfiguration<DeserializationFeature<?>> config) Callback method invoked when the configuration has been changed.Subclasses can override this method to handle configuration changes, such as resetting cached factory instances.
- Parameters:
config- the updated configuration
-
getConfiguration
@NonNull protected dev.metaschema.core.configuration.IMutableConfiguration<DeserializationFeature<?>> getConfiguration()Get the current configuration of the serializer/deserializer.- Returns:
- the configuration
-
isFeatureEnabled
- Specified by:
isFeatureEnabledin interfacedev.metaschema.core.configuration.IConfiguration<T extends dev.metaschema.core.configuration.IConfigurationFeature<?>>
-
getFeatureValues
- Specified by:
getFeatureValuesin interfacedev.metaschema.core.configuration.IConfiguration<T extends dev.metaschema.core.configuration.IConfigurationFeature<?>>
-
get
- Specified by:
getin interfacedev.metaschema.core.configuration.IConfiguration<T extends dev.metaschema.core.configuration.IConfigurationFeature<?>>
-