JacksonMigration

org.apache.pekko.serialization.jackson.JacksonMigration
abstract class JacksonMigration

Data migration of old formats to current format can be implemented in a concrete subclass and configured to be used by the JacksonSerializer for a changed class.

It is used when deserializing data of older version than the JacksonMigration#currentVersion. You implement the transformation of the JSON structure in the JacksonMigration#transform method. If you have changed the class name you should override JacksonMigration#transformClassName and return current class name.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

Define current version, that is, the value used when serializing new data. The first version, when no migration was used, is always 1.

Define current version, that is, the value used when serializing new data. The first version, when no migration was used, is always 1.

Attributes

def transform(fromVersion: Int, json: JsonNode): JsonNode

Implement the transformation of the old JSON structure to the new JSON structure. The 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.

Implement the transformation of the old JSON structure to the new JSON structure. The 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.

Value parameters

fromVersion

the version of the old data

json

the old JSON data

Attributes

Concrete methods

Define the supported forward version this migration can read (must be greater or equal than currentVersion). If this value is different from currentVersion a JacksonMigration may be required to downcast the received payload to the current schema.

Define the supported forward version this migration can read (must be greater or equal than currentVersion). If this value is different from currentVersion a JacksonMigration may be required to downcast the received payload to the current schema.

Attributes

def transformClassName(fromVersion: Int, className: String): String

Override this method if you have changed the class name. Return current class name.

Override this method if you have changed the class name. Return current class name.

Attributes