akshayyn / cloning

Automatically exported from code.google.com/p/cloning
Other
0 stars 0 forks source link

I would like to ignore certain "instance" fields from my cloning process. #24

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a Parent object that contains a List of Child objects.
2. Create a Child object has a reference to its Parent.
3. Parent parent = null;
4. Child child = null;
5. parent.addChild(child);
6. child.setParent(parent);
7. cloner.deepClone(child);

What is the expected output? What do you see instead?
The cloned instance of child has a new copy of parent with a list of copies of 
child.

I would like the cloner to ignore the "parent" field in the child instance and 
not clone it.

What version of the product are you using? 
1.9.0
On what operating system?
Win 7 Enterprise

Please provide any additional information below.
I tried to use the following:
cloner.registerConstant(Child.class, "parent");
But because "parent" is an instance field and not static (i.e. constant) I get 
a NullPointerException.

Original issue reported on code.google.com by waul...@gmail.com on 10 Dec 2013 at 10:10

GoogleCodeExporter commented 8 years ago
hmm, child instance should be == with the parent.child instance, no?

Original comment by kostas.k...@googlemail.com on 21 Jun 2014 at 8:49