public abstract class JacksonJsonMigration extends Object
JacksonJsonSerializer
for a changed class.
It is used when deserializing data of older version than the
currentVersion()
. You implement the transformation of the
JSON structure in the transform(int, com.fasterxml.jackson.databind.JsonNode)
method. If you have changed the
class name you should override transformClassName(int, java.lang.String)
and return
current class name.
Constructor and Description |
---|
JacksonJsonMigration() |
Modifier and Type | Method and Description |
---|---|
abstract int |
currentVersion()
Define current version.
|
abstract com.fasterxml.jackson.databind.JsonNode |
transform(int fromVersion,
com.fasterxml.jackson.databind.JsonNode json)
Implement the transformation of the old JSON structure to the new
JSON structure.
|
String |
transformClassName(int fromVersion,
String className)
Override this method if you have changed the class name.
|
public abstract int currentVersion()
public abstract com.fasterxml.jackson.databind.JsonNode transform(int fromVersion, com.fasterxml.jackson.databind.JsonNode json)
JsonNode
is mutable so you can add and remove fields,
or change values. Note that you have to cast to specific sub-classes such
as ObjectNode
and ArrayNode
to get access to mutators.
fromVersion
- the version of the old datajson
- the old JSON data