Skip to content

Problem using ObjectMerger #115

@luomo

Description

@luomo

Hi,
congrats for the lib, it seems very promising.
Some context, I'm looking to it to understand if it fits the need for a particular project.
One of the use cases, is to understand to create a patch based on the objects differences. I've found the ObjectMerger example, as it seems what I need, but it doesn't seem to work. If finds the differences but it doesn't set those at a deepest level. (in the Children objects)
Here goes a simple code fragment (please don't mind the code as its just dummy code just for illustration proposes)

class A {
private int x;
private B b;
// getters and setters
}

class B {
private int y;
// getters and setters
}

@test
public void myTest3__(){

    B baseB = new B();
    baseB.setY(10);
    A base = new A();
    base.setB(baseB);
    base.setX(10);

    B changeB = new B();
    changeB.setY(12);
    A change = new A();
    change.setB(changeB);
    change.setX(10);


    final A delta = merge(base, change, new A());
    System.out.println(delta);
}

The output is A{x=0, b=null}
Meaning it couldn't find the differences at a B level.

Is this a bug or I'm using it wrongly ?
Thanks

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions