Search code examples
javers

newbie to javers , how to iterate and get all property names from a diff


I am a newbie to javers.

I have two same objects with properties I need to get a list of all the properties that are different.

this works

 Diff diff = javers.compare(memberFromDB, member);
 for (Change c : diff.getChanges()) {
        logger.info("change=" + c );
 }

and displays

change=ValueChange{globalId:'com.stuff.Member/', property:'currentRank', oldVal:'Friend12', newVal:'Dimaon'}

although i assume it is simple, how do i access the property of Change?

Or should i be iterating a different way thought the diff?

my end goal is to get a list of the properties that are different.

thanks


Solution

  •     diff.getChangesByType(PropertyChange.class).forEach(p ->
                logger.info("property change: "+ p.getPropertyName()  )
        );