Skip to content

nkokhelox/InstanceDiff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

InstanceDiff

Build Status

Codacy Badge

Features

  • Given 2 instances of the same java class then this program/library/utility can detected the difference in their properties using java reflections.

  • Given inheritance hierarchy, then we can control how far up we can climb the inheritance hierarchy ladder when looking for differences.

    • InstanceDiff differentiator = new InstanceDiff(<INSTANCE OBJECT 1>, <INSTANCE OBJECT 2>)

      <INSTANCE OBJECT 1>, <INSTANCE OBJECT 2> are objects to be compared, all super classes considered when doing diff by default.

    • InstanceDiff differentiator = new InstanceDiff(<INSTANCE OBJECT 1>, <INSTANCE OBJECT 2>, <HIERARCHY SCOPE LIMIT>)

      <HIERARCHY SCOPE LIMIT> is number of super classes to consider when looking for differences between <INSTANCE OBJECT 1> and <INSTANCE OBJECT 2>.

  • This can find the differences as follows:

    • All instance fields

      Set<InstanceDiff.FieldDiff> diffSet = differentiator.getDiff();

    • Specific fields

      Set<InstanceDiff.FieldDiff> diffSet = differentiator.getDiffOf(Set<String> fieldNamesToGetTheDiffOfOnly);

    • All fields excluding specific fields

      Set<InstanceDiff.FieldDiff> diffSet = differentiator.getDiffExcluding(Set<String> fieldNamesToExcludeInDiff);

  • InstanceDiff.FieldDiff = Class{fieldName, valueOnInstance1, valueOnInstance2}

  • Check the tests to further learn about this thing usage.

About

Given 2 instances of the same class then the difference can be detected using reflections.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages