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 Details

  • 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:
      getConstraintValidationHandler in interface IDeserializer<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: IDeserializer
      Set the constraint violation handler for constraint validation.
      Specified by:
      setConstraintValidationHandler in interface IDeserializer<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: IDeserializer
      Read data from the Reader into a node item instance.
      Specified by:
      deserializeToNodeItem in interface IDeserializer<CLASS extends dev.metaschema.core.model.IBoundObject>
      Parameters:
      reader - the reader to read from
      documentUri - 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 from
      documentUri - 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

      public final CLASS deserializeToValue(Reader reader, URI documentUri) throws IOException
      Description copied from interface: IDeserializer
      Read data from the Reader into a node item instance.
      Specified by:
      deserializeToValue in interface IDeserializer<CLASS extends dev.metaschema.core.model.IBoundObject>
      Parameters:
      reader - the reader to read from
      documentUri - 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 from
      documentUri - 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:
      enableFeature in interface IDeserializer<CLASS extends dev.metaschema.core.model.IBoundObject>
      Specified by:
      enableFeature in interface dev.metaschema.core.configuration.IMutableConfiguration<CLASS extends dev.metaschema.core.model.IBoundObject>
    • disableFeature

      Specified by:
      disableFeature in interface IDeserializer<CLASS extends dev.metaschema.core.model.IBoundObject>
      Specified by:
      disableFeature in interface dev.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:
      applyConfiguration in interface IDeserializer<CLASS extends dev.metaschema.core.model.IBoundObject>
      Specified by:
      applyConfiguration in interface dev.metaschema.core.configuration.IMutableConfiguration<CLASS extends dev.metaschema.core.model.IBoundObject>
    • set

      public IDeserializer<CLASS> set(DeserializationFeature<?> feature, Object value)
      Specified by:
      set in interface IDeserializer<CLASS extends dev.metaschema.core.model.IBoundObject>
      Specified by:
      set in interface dev.metaschema.core.configuration.IMutableConfiguration<CLASS extends dev.metaschema.core.model.IBoundObject>
    • getBindingContext

      @NonNull protected IBindingContext getBindingContext()
      Retrieve the binding context associated with the serializer.
      Returns:
      the binding context
    • getDefinition

      @NonNull protected IBoundDefinitionModelAssembly 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

      public boolean isFeatureEnabled(DeserializationFeature<?> feature)
      Specified by:
      isFeatureEnabled in interface dev.metaschema.core.configuration.IConfiguration<T extends dev.metaschema.core.configuration.IConfigurationFeature<?>>
    • getFeatureValues

      public Map<DeserializationFeature<?>,Object> getFeatureValues()
      Specified by:
      getFeatureValues in interface dev.metaschema.core.configuration.IConfiguration<T extends dev.metaschema.core.configuration.IConfigurationFeature<?>>
    • get

      public <V> V get(DeserializationFeature<?> feature)
      Specified by:
      get in interface dev.metaschema.core.configuration.IConfiguration<T extends dev.metaschema.core.configuration.IConfigurationFeature<?>>