Reputation: 203
Can Javers be used to calculate the differences using class/object like metamodels instead of concrete Java classes?
My research so far leads me to believe Javers differences only works on models which are realized as concrete Java classes.
Similarly with the java-object-diff library.
I have a metamodel in which a single model contains roughly similar information to what one gets using the Java Reflection APIs (i.e. Class, Field). I also have model object instances, which are similar to a Java Object (i.e. an instance of a class). Both the metamodel and model object instances are Java classes, but the classes themselves are general reused modeling classes and uninteresting themselves.
I'm expecting to have to do quite a bit of wiring to expose the details of the metamodel to the differencing algorithm, equivalent to what one gets from the Java Reflection API and the usual Java object semantics. Such as:
etc.
Upvotes: 0
Views: 323
Reputation: 3496
JaVers uses a metamodel internally to compare user's objects.
User's objects are mapped to Cdo
abstraction.
(see https://javers.org/javadoc_3.x/org/javers/core/metamodel/object/Cdo.html)
and then Cdo
instances are compared.
So, the whole diff algorithm is based on the metamodel. But, it's the JaVers' metamodel. Is JaVers ready to handle any kind of metamodel? Probably not.
Is JaVers ready to handle your metamodel? It's hard to say without seeing it, but I doubt.
What I can suggest, try to convert your metamodel to the JaVers' metamodel. Provide Cdo
instances, for example CdoSnapshot
and compare them.
Upvotes: 0