Annotation Interface Revision


@Retention(RUNTIME) @Target(TYPE) @Documented public @interface Revision
Specifies the revision number of a persistable object, such as a message payload, document, or aggregate snapshot.

Revisions are used to version serialized data, allowing for upcasting migration when older versions are read from storage or received from other systems.

If this annotation is not present, the revision is assumed to be 0.

The revision number is stored in the serialized Data object and used to determine whether an Upcaster needs to be applied during deserialization.

Revisions are commonly used in conjunction with:

  • Message payloads sent through the event store or command log
  • Serialized documents stored in the document store
  • Aggregate snapshots used for efficient rehydration of event-sourced entities

Example


 @Revision(3)
 public class ProductDetails {
     String name;
     String description;
 }
 

This indicates that the current version of the class is revision 3, and upcasters may be provided for earlier revisions when deserializing older data.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    int
    The revision number of the annotated class.
  • Element Details

    • value

      int value
      The revision number of the annotated class. Defaults to 0 if not explicitly set.
      Returns:
      the revision number