public static class JacksonSerializer.Builder extends Object
JacksonSerializer
.
The RevisionResolver
is defaulted to an AnnotationRevisionResolver
, the Converter
to a
ChainingConverter
, the ObjectMapper
defaults to a ObjectMapper.ObjectMapper()
result and
the ClassLoader
to the result of an Object#getClass()#getClassLoader()
call.
Upon instantiation, the ObjectMapper will get two modules registered to it by default, (1) the
MetaDataDeserializer
and the (2) JavaTimeModule
. Lastly, if the provided converter is of type
ChainingConverter, the JacksonSerializer.registerConverters(org.axonframework.serialization.ChainingConverter)
is performed to automatically add the
{@link JsonNodeToByteArrayConverter) and {@link ByteArrayToJsonNodeConverter).
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
JacksonSerializer |
build()
Initializes a
JacksonSerializer as specified through this Builder. |
JacksonSerializer.Builder |
classLoader(ClassLoader classLoader)
Sets the
ClassLoader used to load classes with when deserializing. |
JacksonSerializer.Builder |
converter(Converter converter)
Sets the
Converter used as a converter factory providing converter instances utilized by upcasters
to convert between different content types. |
JacksonSerializer.Builder |
objectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Sets the
ObjectMapper used to serialize and parse the objects to JSON. |
JacksonSerializer.Builder |
revisionResolver(RevisionResolver revisionResolver)
Sets the
RevisionResolver used to resolve the revision from an object to be serialized. |
protected void |
validate()
Validates whether the fields contained in this Builder are set accordingly.
|
public JacksonSerializer.Builder revisionResolver(RevisionResolver revisionResolver)
RevisionResolver
used to resolve the revision from an object to be serialized. Defaults to
an AnnotationRevisionResolver
which resolves the revision based on the contents of the
Revision
annotation on the serialized classes.revisionResolver
- a RevisionResolver
used to resolve the revision from an object to be
serializedpublic JacksonSerializer.Builder converter(Converter converter)
Converter
used as a converter factory providing converter instances utilized by upcasters
to convert between different content types. Defaults to a ChainingConverter
.converter
- a Converter
used as a converter factory providing converter instances utilized by
upcasters to convert between different content typespublic JacksonSerializer.Builder objectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
ObjectMapper
used to serialize and parse the objects to JSON. This ObjectMapper allows for
customization of the serialized form. Defaults to the output of ObjectMapper.ObjectMapper()
.objectMapper
- an ObjectMapper
used to serialize and parse the objects to JSONpublic JacksonSerializer.Builder classLoader(ClassLoader classLoader)
ClassLoader
used to load classes with when deserializing. Defaults to the result of an
Object#getClass()#getClassLoader()
call.classLoader
- the ClassLoader
used to load classes with when deserializingpublic JacksonSerializer build()
JacksonSerializer
as specified through this Builder.JacksonSerializer
as specified through this Builderprotected void validate() throws AxonConfigurationException
AxonConfigurationException
- if one field is asserted to be incorrect according to the Builder's
specificationsCopyright © 2010–2018. All rights reserved.