Created
July 17, 2016 09:55
-
-
Save AlexBHarley/70d7bf765e90c8535a425f077c0fc95d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Regarding the object deltas, I think there are a couple of ways to do it. | |
I've found a couple of different libraries for diffing objects: | |
https://github.com/SQiShER/java-object-diff | |
http://javers.org/documentation | |
These both seem kind of overkill. | |
Lets say we have a Person class as follows | |
class Person { | |
String name; | |
int age; | |
String hairColour; | |
Person(String name, int age, String hairColour) { | |
this.name = name; | |
this.age = age; | |
this.hairColour = hairColour; | |
} | |
} | |
I propose a basic API as follows: | |
Record record = ds.record.getRecord('simpsons/2'); | |
Person person = record.get(Person.class); | |
System.out.println(person.name); | |
// Marge | |
System.out.println(person.age); | |
// 30 | |
person.age = 40; | |
record.set(person); | |
// R|P|simpsons/2|2|age|N40+ | |
person.age = 50; | |
person.hairColour = "Green"; | |
record.set(person); | |
// R|U|simpsons/2|4|{"name":"Marge","age":50,"hairColour":"Green"}+ | |
// as opposed to two patch statements |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment