Module dev.metaschema.databind
Package dev.metaschema.databind.io.xml
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>
Provides support for reading XML-based data based on a bound Metaschema
module.
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultXmlDeserializer(IBoundDefinitionModelAssembly definition) Construct a new Module binding-based deserializer that reads XML-based Module content. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCallback method invoked when the configuration has been changed.protected final IDocumentNodeItemdeserializeToNodeItemInternal(Reader reader, URI documentUri) This abstract method delegates parsing to the concrete implementation.final CLASSdeserializeToValueInternal(Reader reader, URI resource) This abstract method delegates parsing to the concrete implementation, returning the deserialized value directly.<V> Vget(DeserializationFeature<?> feature) Get the configuration value of the providedfeature.protected IBindingContextRetrieve the binding context associated with the serializer.protected IMutableConfiguration<DeserializationFeature<?>>Get the current configuration of the serializer/deserializer.protected IBoundDefinitionModelAssemblyRetrieve the bound class information associated with the assembly that the serializer/deserializer will write/read data from.Get the mapping of each feature mapped to its value.booleanisFeatureEnabled(DeserializationFeature<?> feature) Determines if a specific feature is enabled.protected org.codehaus.stax2.XMLInputFactory2Get a JSON factory instance.protected final voidFor use by subclasses to reset the underlying XML factory when an important change has occurred that will change how the factory produces anXMLInputFactory2.Methods inherited from class dev.metaschema.databind.io.AbstractDeserializer
applyConfiguration, deserializeToNodeItem, deserializeToValue, disableFeature, enableFeature, getConstraintValidationHandler, set, setConstraintValidationHandlerMethods 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
-
DefaultXmlDeserializer
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 anXMLInputFactory2. -
configurationChanged
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:AbstractDeserializerThis abstract method delegates parsing to the concrete implementation.- Specified by:
deserializeToNodeItemInternalin classAbstractDeserializer<CLASS extends IBoundObject>- 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
-
deserializeToValueInternal
Description copied from class:AbstractDeserializerThis abstract method delegates parsing to the concrete implementation, returning the deserialized value directly.- Specified by:
deserializeToValueInternalin classAbstractDeserializer<CLASS extends IBoundObject>- Parameters:
reader- the reader instance to read data fromresource- 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
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
-
getConfiguration
Get the current configuration of the serializer/deserializer.- Returns:
- the configuration
-
isFeatureEnabled
Description copied from interface:IConfigurationDetermines if a specific feature is enabled.- Specified by:
isFeatureEnabledin interfaceIConfiguration<T extends IConfigurationFeature<?>>- Parameters:
feature- the feature to check for- Returns:
trueif the feature is enabled, orfalseotherwise- See Also:
-
getFeatureValues
Description copied from interface:IConfigurationGet the mapping of each feature mapped to its value.- Specified by:
getFeatureValuesin interfaceIConfiguration<T extends IConfigurationFeature<?>>- Returns:
- the mapping
-
get
Description copied from interface:IConfigurationGet the configuration value of the providedfeature.- Specified by:
getin interfaceIConfiguration<T extends IConfigurationFeature<?>>- Type Parameters:
V- the value type- Parameters:
feature- the requested feature- Returns:
- the value of the feature
-