Class DefaultXmlDeserializer<CLASS extends IBoundObject>

java.lang.Object
dev.metaschema.databind.io.AbstractDeserializer<CLASS>
dev.metaschema.databind.io.xml.DefaultXmlDeserializer<CLASS>
Type Parameters:
CLASS - the Java type of the bound object representing the root node to read
All Implemented Interfaces:
IConfiguration<DeserializationFeature<?>>, IMutableConfiguration<DeserializationFeature<?>>, IDeserializer<CLASS>

public class DefaultXmlDeserializer<CLASS extends IBoundObject> extends AbstractDeserializer<CLASS>
Provides support for reading XML-based data based on a bound Metaschema module.
  • Constructor Details

    • DefaultXmlDeserializer

      public DefaultXmlDeserializer(@NonNull IBoundDefinitionModelAssembly definition)
      Construct a new Module binding-based deserializer that reads XML-based Module content.
      Parameters:
      definition - the assembly class binding describing the Java objects this deserializer parses data into
  • Method Details

    • resetFactory

      protected final void resetFactory()
      For use by subclasses to reset the underlying XML factory when an important change has occurred that will change how the factory produces an XMLInputFactory2.
    • configurationChanged

      protected void configurationChanged(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
    • newFactoryInstance

      @NonNull protected org.codehaus.stax2.XMLInputFactory2 newFactoryInstance()
      Get a JSON factory instance.

      This method can be used by sub-classes to create a customized factory instance.

      Returns:
      the factory
    • deserializeToNodeItemInternal

      protected final IDocumentNodeItem deserializeToNodeItemInternal(Reader reader, URI documentUri) throws IOException
      Description copied from class: AbstractDeserializer
      This abstract method delegates parsing to the concrete implementation.
      Specified by:
      deserializeToNodeItemInternal in class AbstractDeserializer<CLASS extends IBoundObject>
      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
    • deserializeToValueInternal

      public final CLASS deserializeToValueInternal(Reader reader, URI resource) throws IOException
      Description copied from class: AbstractDeserializer
      This abstract method delegates parsing to the concrete implementation, returning the deserialized value directly.
      Specified by:
      deserializeToValueInternal in class AbstractDeserializer<CLASS extends IBoundObject>
      Parameters:
      reader - the reader instance to read data from
      resource - 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
    • 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
    • getConfiguration

      @NonNull protected IMutableConfiguration<DeserializationFeature<?>> getConfiguration()
      Get the current configuration of the serializer/deserializer.
      Returns:
      the configuration
    • isFeatureEnabled

      public boolean isFeatureEnabled(DeserializationFeature<?> feature)
      Description copied from interface: IConfiguration
      Determines if a specific feature is enabled.
      Specified by:
      isFeatureEnabled in interface IConfiguration<T extends IConfigurationFeature<?>>
      Parameters:
      feature - the feature to check for
      Returns:
      true if the feature is enabled, or false otherwise
      See Also:
    • getFeatureValues

      public Map<DeserializationFeature<?>,Object> getFeatureValues()
      Description copied from interface: IConfiguration
      Get the mapping of each feature mapped to its value.
      Specified by:
      getFeatureValues in interface IConfiguration<T extends IConfigurationFeature<?>>
      Returns:
      the mapping
    • get

      public <V> V get(DeserializationFeature<?> feature)
      Description copied from interface: IConfiguration
      Get the configuration value of the provided feature.
      Specified by:
      get in interface IConfiguration<T extends IConfigurationFeature<?>>
      Type Parameters:
      V - the value type
      Parameters:
      feature - the requested feature
      Returns:
      the value of the feature