#19 Add parent-annotation.

open
nobody
None
5
2011-12-12
2011-12-12
Ulrik Mikaelsson
No

I have the same need as in http://sourceforge.net/mailarchive/message.php?msg_id=18818100. Basically I need to, in a child, access the parent-pojo after deserialization.

I did not get the proposed solution working, but irregardless I think it's a usecase common enough to deserve @Parent-annotation, which should resolve to the closest "upstream" @Root-annotated object. It should not affect serialization.

I.E.

@Root
class Parent {
@Element ArrayList<Child> child;
}

@Root
class Child {
@Parent
Parent myParent;
}

myParent should after serialization reference an instance of Parent. Mismatch between expected parent-type and actual parent-type should throw an exception (such as a ClassCastException).

Discussion