Class DefaultXmlSerializer<CLASS extends IBoundObject>
java.lang.Object
gov.nist.secauto.metaschema.databind.io.AbstractSerializer<CLASS>
gov.nist.secauto.metaschema.databind.io.xml.DefaultXmlSerializer<CLASS>
- All Implemented Interfaces:
IConfiguration<SerializationFeature<?>>
,IMutableConfiguration<SerializationFeature<?>>
,ISerializer<CLASS>
-
Constructor Summary
ConstructorDescriptionDefaultXmlSerializer
(IBoundDefinitionModelAssembly definition) Construct a new XML serializer based on the top-level assembly indicated by the providedclassBinding
. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
<V> V
get
(SerializationFeature<?> feature) protected IBindingContext
Retrieve the binding context associated with the serializer.protected IMutableConfiguration<SerializationFeature<?>>
Get the current configuration of the serializer/deserializer.protected IBoundDefinitionModelAssembly
Retrieve the bound class information associated with the assembly that the serializer/deserializer will write/read data from.protected final org.codehaus.stax2.XMLOutputFactory2
Get the configured XML output factory used to createXMLStreamWriter2
instances.boolean
isFeatureEnabled
(SerializationFeature<?> feature) protected org.codehaus.stax2.XMLOutputFactory2
Get a JSON factory instance.protected final org.codehaus.stax2.XMLStreamWriter2
newXMLStreamWriter
(Writer writer) Create a new stream writer using the provided writer.protected final void
void
serialize
(IBoundObject data, Writer writer) Write data from a bound class instance to theWriter
.Methods inherited from class gov.nist.secauto.metaschema.databind.io.AbstractSerializer
applyConfiguration, disableFeature, enableFeature, set
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.ISerializer
serialize, serialize, serialize
-
Constructor Details
-
DefaultXmlSerializer
Construct a new XML serializer based on the top-level assembly indicated by the providedclassBinding
.- Parameters:
definition
- the bound Module assembly definition that describes the data to serialize
-
-
Method Details
-
resetFactory
-
configurationChanged
-
newFactoryInstance
Get a JSON factory instance.This method can be used by sub-classes to create a customized factory instance.
- Returns:
- the factory
-
getXMLOutputFactory
Get the configured XML output factory used to createXMLStreamWriter2
instances.- Returns:
- the factory
-
newXMLStreamWriter
@NonNull protected final org.codehaus.stax2.XMLStreamWriter2 newXMLStreamWriter(@NonNull Writer writer) throws IOException Create a new stream writer using the provided writer.- Parameters:
writer
- the writer to use for output- Returns:
- the stream writer created by the output factory
- Throws:
IOException
- if an error occurred while creating the writer
-
serialize
Description copied from interface:ISerializer
Write data from a bound class instance to theWriter
.- Parameters:
data
- the instance datawriter
- the writer to write to- Throws:
IOException
- if an error occurred while writing data to 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
- Specified by:
isFeatureEnabled
in interfaceIConfiguration<T extends IConfigurationFeature<?>>
-
getFeatureValues
- Specified by:
getFeatureValues
in interfaceIConfiguration<T extends IConfigurationFeature<?>>
-
get
- Specified by:
get
in interfaceIConfiguration<T extends IConfigurationFeature<?>>
-