This line is exactly the problem:
((Data1) h.get("data1")).setSomeValue(d2.getSomeValue());
The key "data1" should represent a node in a tree. Let's say "child3_2". Now the only chance for mapping the change of this node back to the first data object d1 is the the name "child3_2".
I cannot say call the getter method xy because I don't know which node goes to which value in the data object d1. To make matters worse the first data object has a lot of nested elements
I don't like doing a very long switch loop like this
switch(node_name)
case 1 ; d1.setSomeValue(newNodeValue);
Because this will be a very long list with more loops in it.
Any chance of doing this with reflection or something else?