users@jaxb.java.net

Extending Classes And No Separation Of Xml Source

From: Roman Rädle <Roman.Raedle_at_uni-konstanz.de>
Date: Tue, 24 Jun 2008 18:55:28 +0200

Hello list,

Is there any chance to extend a Java class, lets say class A, and call
the subclass A again and

Well, within one of a project we want to separate the logical code and
visual code. The only dependency is that the visual code knows about
the logical code.

As an example we have a class A within the logical code package which
contains an object of class B.

@XmlType(name = "a")
@XmlRootElement(name = "a")
public class A {

     @XmlElement(name = "b")
     private B b;

     public B getB() {
         return b;
     }

     public void setB(B b) {
         this.b = b;
     }
}

The visual code packet should extend the class A which is called A
again and this new class should have an object of class C as extension.

@XmlType(name = "a")
@XmlRootElement(name = "a")
public class A extends logical.A {

     @XmlElement(name = "c")
     private C c;

     public C getC() {
         return c;
     }

     public void setC(C c) {
         this.c = c;
     }
}

So it would allow us to import the same xml source in logical or
visual or both cases without separating the xml code (two different
files). Now the example above leads to namespace conflicts.

Would it be possible to handle object with JAXB like that? Or is there
any other chance to separate code packages in other ways?

Best Regards,
   -- Roman