Tip
|
Just a quick snippet |
Maven Integration
pom.xml
<dependency>
<groupId>org.javers</groupId>
<artifactId>javers-core</artifactId>
<version>${javers.version}</version>
</dependency>
Calculate Changes in Object Graph
package io.hascode;
import org.javers.core.Changes;
import org.javers.core.Javers;
import org.javers.core.JaversBuilder;
import org.javers.core.diff.Diff;
public <T> Changes diff(T snapshot, T latest) {
Javers javers = JaversBuilder.javers().build();
Diff diff = javers.compare(snapshot, latest);
return diff.getChanges();
}