javers

Retrieve only left, right, propertyName from the javers Change class


I am using the following code to retreive the changes made to a version in my API response

List<Change> versionChanges = javers.findChanges(jqlQuery.build()).groupByCommit()get(0).get()

It gave me the following https://user-images.githubusercontent.com/10185101/122550135-f3223b00-d050-11eb-9cc8-72982808cd2e.png

But I don't want this entire data to go as my API response I just want to isolate left, right, propertyName in my response

I am not able to find an API on Change.class that can do me so ..

How can I achieve this

Thank you


Solution

  • List<ChangesByCommit> changes = javers.findChanges(jqlQuery.build()).groupByCommit();
    ValueChange valueChange = (ValueChange)changes.get(0).get().get(0);
    String property = valueChange.getPropertyName();
    Object originalValue = valueChange.getLeft();
    Object newValue = valueChange.getRight();