Class ChangedMapField

java.lang.Object
org.litebridgedb.tracking.ChangedField
org.litebridgedb.tracking.ChangedMapField

public final class ChangedMapField extends ChangedField
Map-specific type of ChangedField which holds a snapshot of the original underlying map.

This class is a final implementation that provides additional functionality for handling changes to Map-type fields.

It inherits the common properties and behavior from the ChangedField class and extends it by including a snapshot of the original map associated with the field.

It ensures that the map snapshot is immutable.

  • Constructor Details

    • ChangedMapField

      public ChangedMapField(String fieldName, @Nullable Object value, @Nullable Map<?,Integer> mapSnapshot)
      Construct a ChangedMapField instance representing a change in a map field, including a snapshot of its original state as an immutable map.
      Parameters:
      fieldName - the name of the field being tracked
      value - the new value of the field
      mapSnapshot - the original state of the map field, stored as an immutable map
  • Method Details

    • mapSnapshot

      public Map<?,Integer> mapSnapshot()
      Retrieve the snapshot of the original map associated with this field.
      Returns:
      an immutable Map containing the snapshot of the original map, where keys are of an unspecified type and values are integers.
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class ChangedField
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class ChangedField
    • toString

      public String toString()
      Overrides:
      toString in class ChangedField