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); } } } // ... }
Modifier and Type | Interface and Description |
---|---|
static interface |
RecordV2Delta.Change
Represents a single change between one record value and another.
|
Modifier and Type | Method and Description |
---|---|
List<RecordV2Delta.Change> |
changes(Schema schema)
Returns a list of the changes represented by the delta with reference to
a specified schema.
|
List<RecordV2Delta.Change> changes(Schema 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.
schema
- the schemaCopyright © 2022 Push Technology Ltd. All Rights Reserved.