Class Mod
- java.lang.Object
-
- org.apache.beam.sdk.io.gcp.spanner.changestreams.model.Mod
-
- All Implemented Interfaces:
java.io.Serializable
@DefaultCoder(org.apache.beam.sdk.coders.AvroCoder.class) public class Mod extends java.lang.Object implements java.io.Serializable
Represents a modification in a table emitted within aDataChangeRecord
. Each mod contains keys, new values and old values returned as JSON strings.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Mod(java.lang.String keysJson, java.lang.String oldValuesJson, java.lang.String newValuesJson)
Constructs a mod from the primary key values, the old state of the row and the new state of the row.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
java.lang.String
getKeysJson()
The primary keys of this specific modification.java.lang.String
getNewValuesJson()
The new column values after the modification was applied.java.lang.String
getOldValuesJson()
The old column values before the modification was applied.int
hashCode()
java.lang.String
toString()
-
-
-
Constructor Detail
-
Mod
public Mod(java.lang.String keysJson, @Nullable java.lang.String oldValuesJson, @Nullable java.lang.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 valuesoldValuesJson
- JSON object as String, displaying the old state of the columns modified. This JSON object can be null in the case of an INSERTnewValuesJson
- 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 Detail
-
getOldValuesJson
@Nullable public java.lang.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 java.lang.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 java.lang.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 java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-