java.lang.Object
org.apache.beam.sdk.io.gcp.spanner.changestreams.model.Mod
All Implemented Interfaces:
Serializable

@DefaultCoder(AvroCoder.class) public class Mod extends Object implements Serializable
Represents a modification in a table emitted within a DataChangeRecord. Each mod contains keys, new values and old values returned as JSON strings.
See Also:
  • Constructor Details

    • Mod

      public Mod(String keysJson, @Nullable String oldValuesJson, @Nullable String newValuesJson)
      Constructs a mod from the primary key values, the old state of the row and the new state of the row.
      Parameters:
      keysJson - JSON object as String, where the keys are the primary key column names and the values are the primary key column values
      oldValuesJson - JSON object as String, displaying the old state of the columns modified. This JSON object can be null in the case of an INSERT
      newValuesJson - JSON object as String, displaying the new state of the columns modified. This JSON object can be null in the case of a DELETE
  • Method Details

    • getOldValuesJson

      @Nullable public String getOldValuesJson()
      The old column values before the modification was applied. This can be null when the modification was emitted for an INSERT operation. The values are returned as a JSON object (stringified), where the keys are the column names and the values are the column values.
      Returns:
      JSON object as String representing the old column values before the row was modified
    • getNewValuesJson

      @Nullable public String getNewValuesJson()
      The new column values after the modification was applied. This can be null when the modification was emitted for a DELETE operation. The values are returned as a JSON object (stringified), where the keys are the column names and the values are the column values.
      Returns:
      JSON object as String representing the new column values after the row was modified
    • getKeysJson

      public String getKeysJson()
      The primary keys of this specific modification. This is always present and can not be null. The keys are returned as a JSON object (stringified), where the keys are the column names and the values are the column values.
      Returns:
      JSON object as String representing the primary key state for the row modified
    • equals

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

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

      public String toString()
      Overrides:
      toString in class Object