Class XStreamSerializer.Builder

java.lang.Object
org.axonframework.serialization.AbstractXStreamSerializer.Builder
org.axonframework.serialization.xml.XStreamSerializer.Builder
Enclosing class:
XStreamSerializer

public static class XStreamSerializer.Builder extends AbstractXStreamSerializer.Builder
Builder class to instantiate a XStreamSerializer.

The XStream is defaulted to a XStream(HierarchicalStreamDriver) call, providing a CompactDriver, the Charset is defaulted to a Charset.forName(String) using the UTF-8 character set, the RevisionResolver defaults to an AnnotationRevisionResolver and the Converter defaults to a ChainingConverter. Lastly, the builder adds Axon types for XStream's security settings by including "org.axonframework.** as a wildcard type. This can be disabled with the disableAxonTypeSecurity() operation when required.

Upon instantiation, several defaults aliases are added to the XStream instance, for example for the GenericDomainEventMessage, the GenericCommandMessage and the MetaData objects among others. Additionally, a MetaData Converter is registered too. Lastly, if the provided Converter instance is of type ChainingConverter, then the XStreamSerializer.registerConverters(ChainingConverter) function will be called. This will register the Dom4JToByteArrayConverter, InputStreamToDom4jConverter, XomToStringConverter and InputStreamToXomConverter to the Converter chain.