Community
Participate
Working Groups
Provide equivalent functionality to Sun's CycleRecoverable in MOXy. See: http://jaxb.java.net/guide/Mapping_cyclic_references_to_XML.html http://www.java.net/node/654639
The following class demonstrates how this is used in the RI: //======================== package cyclerecovery; import javax.xml.bind.annotation.XmlRootElement; import com.sun.xml.bind.CycleRecoverable; @XmlRootElement public class Data implements CycleRecoverable { public String key; public Data parentData; public Data childData; @Override public Data onCycleDetected(Context context) { System.err.println("CYCLE DETECTED"); Data d = new Data(); d.key = "cycle-buster"; return d; } } //======================== ... Data d1 = new Data(); d1.key = "parent"; Data d2 = new Data(); d2.key = "child"; d1.childData = d2; d2.parentData = d1; m.marshal(d1, System.out); ... //======================== Note that in the RI, the com.sun.xml.bind.CycleRecoverable interface works, but the com.sun.xml.internal.bind.CycleRecoverable does not.
Created attachment 214325 [details] Patch - code changes
Created attachment 214327 [details] Patch - code changes
Created attachment 214329 [details] Patch - code changes
Created attachment 214388 [details] Patch - code changes
Created attachment 214398 [details] Patch - code changes
Created attachment 214416 [details] Patch - Code changes (trunk)
Created attachment 214417 [details] Patch - Test changes (trunk)
Created attachment 214424 [details] WIP
Created attachment 214618 [details] Patch - code changes
Created attachment 214619 [details] Patch - test changes
Created attachment 214621 [details] Patch - code changes
Created attachment 214626 [details] Patch - code changes
Completed and checked into trunk (2.4.0). Reviewed by bdoughan.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink