Class DefaultXmlSerializer<CLASS>

    • Constructor Detail

      • DefaultXmlSerializer

        public DefaultXmlSerializer​(@NonNull
                                    IAssemblyClassBinding classBinding)
        Construct a new XML serializer based on the top-level assembly indicated by the provided classBinding.
        Parameters:
        classBinding - the bound Module assembly definition that describes the data to serialize
    • Method Detail

      • getXMLOutputFactory

        @NonNull
        protected final org.codehaus.stax2.XMLOutputFactory2 getXMLOutputFactory()
        Get the configured XML output factory used to create XMLStreamWriter2 instances.
        Returns:
        the factory
      • setXMLOutputFactory

        protected void setXMLOutputFactory​(@NonNull
                                           org.codehaus.stax2.XMLOutputFactory2 xmlOutputFactory)
        Override the default XMLOutputFactory2 instance with a custom factory.
        Parameters:
        xmlOutputFactory - the new 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

        public void serialize​(CLASS data,
                              Writer writer)
                       throws IOException
        Description copied from interface: ISerializer
        Write data from a bound class instance to the Writer.
        Parameters:
        data - the instance data
        writer - the writer to write to
        Throws:
        IOException - if an error occurred while writing data to the stream
      • getBindingContext

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

        @NonNull
        protected IAssemblyClassBinding getClassBinding()
        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
                                            IMutableConfiguration<T> config)
      • getConfiguration

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