Skip to content
This repository was archived by the owner on Aug 8, 2020. It is now read-only.

Repository files navigation

Diff Maven CentralBuild StatusSonarQube Coverage

Allows to diff any two Java objects and retrieve the diff result as a list of strings. The result is a unified diff without any contextual lines.

Requirements

Example code

SomeDomainObjectbase = getPersistedObject();
SomeDomainObjectworking = getManipulatedObject();
Configurationconfiguration = newConfiguration()
.excludeProperty("someUnwantedPropertyName")
.useSerializer(newSomeSerializer())
.useComparator(newSomeComparator())
.useNaturalOrderingFor(SomeComparable.class)
.useBaseObjectName("BaseObject")
.useWorkingObjectName("WorkingObject");
List<String> differences = newDiffer(configuration).diff(base, working);
for (Stringdiff : differences) {
System.out.println(diff);
}
...

Example output

--- BaseObject+++ WorkingObject@@ -1,1 +1,4 @@-SomeDomainObject.someIntegerProperty='21'+SomeDomainObject.someIntegerProperty='42'+SomeDomainObject.someIterableProperty[0]='foo'+SomeDomainObject.someIterableProperty[1]='bar'+SomeDomainObject.someMapProperty['someMapKey']='someMapValue'
...

For more details have a look at the wiki.

About

Allows to diff two arbitrary Java objects and retrieve the diff result as a list of strings.

Resources

Contributing

Stars

3 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages