4 Kasım 2009 Çarşamba

limitation: circular relationships in web services


object model can represent a graph at the server side and it must be serialized into an xml which can only represent a tree (not a graph especially with cycles) while using xml web services.. 



CycleRecoverable is an interface which detects cycles on the implementing object and executes the method onCycleDetected when the object is about to serialize into XML. Thus it gives you a chance to break the cycles in the object graph and make it a tree, thus representable by xml. 

import com.sun.xml.bind.CycleRecoverable;
import com.sun.xml.bind.CycleRecoverable.Context;

public class Clazz implements  CycleRecoverable {
// ...
@Override
    public Object onCycleDetected(Context arg0) {
        // do whatever you do
        return object;
    }

Hiç yorum yok:

Yorum Gönder