Interface RecordV2Delta
public interface RecordV2Delta
RecordV2 structural delta.
A RecordV2Delta describes the differences between two RecordV2
values. Unlike a binary delta, a structural delta can be queried to determine its effect. The
changes(com.pushtechnology.diffusion.datatype.recordv2.schema.Schema) method provides details of which values have changed.
An instance can be created from two RecordV2 values using
RecordV2.diff(RecordV2).
RecordV2Deltas are useful for identifying small changes to complex RecordV2
values. Here's any example of how to use this class to filter interesting
changes in a
ValueStream.
public class ExampleStream implements ValueStream<RecordV2> {
public void onValue(String topicPath, RecordV2 oldValue, RecordV2 newValue) {
RecordV2Delta delta = newValue.diff(oldValue);
for (Change change : delta.changes(schema)) {
if (change.fieldName().equals("address") {
processAddress(newValue);
}
}
}
// ...
}
- Since:
- 6.0
- Author:
- DiffusionData Limited
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents a single change between one record value and another. -
Method Summary
Modifier and TypeMethodDescriptionReturns a list of the changes represented by the delta with reference to a specified schema.
-
Method Details
-
changes
Returns a list of the changes represented by the delta with reference to a specified schema.The schema supplied must comply with the data format of the delta. No validation takes place, so if the schema does not match the data then the results may be unpredictable.
- Parameters:
schema- the schema- Returns:
- the list of changes
-