abstract class JacksonMigration extends AnyRef
- Alphabetic
- By Inheritance
- JacksonMigration
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new JacksonMigration()
Abstract Value Members
- abstract def currentVersion: Int
Define current version, that is, the value used when serializing new data.
Define current version, that is, the value used when serializing new data. The first version, when no migration was used, is always 1.
- abstract def transform(fromVersion: Int, json: JsonNode): JsonNode
Implement the transformation of the old JSON structure to the new JSON structure.
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 asObjectNode
andArrayNode
to get access to mutators.- fromVersion
the version of the old data
- json
the old JSON data
Concrete Value Members
- def supportedForwardVersion: Int
Define the supported forward version this migration can read (must be greater or equal than
currentVersion
).Define the supported forward version this migration can read (must be greater or equal than
currentVersion
). If this value is different from a JacksonMigration may be required to downcast the received payload to the current schema. - def transformClassName(fromVersion: Int, className: String): String
Override this method if you have changed the class name.
Override this method if you have changed the class name. Return current class name.
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.