fieldenms / tg

Trident Genesis
MIT License
14 stars 7 forks source link

Entity deep equals #85

Open 01es opened 9 years ago

01es commented 9 years ago

Sometimes it becomes necessary to check if the two entity instances are not just equal from the perspective of business key, but are actually identical -- have equal values for all properties together with properties of those properties etc.

Need to extend class AbstractEntity with method deepEquals that would use DFS or BFS algorithm for deep comparison of entity instances. The implementation should take into account proxy values.

01es commented 9 years ago

The graph traversal algorithm implementation for deep equality should explore the interable (java.lang.Iterable) and streaming (java.util.stream.Stream) concepts. The rational for this is to be able to use Streaming API for analysing inequality reasons (for example, find the first two properties that do not match, or find whether inequality is caused by a property with certain meta-data). Streaming provides a way to achieve these results in a lazy and declarative manner.