users@jaxb.java.net

Problem with jxb:class implClass and jaxb1.0 to 2.1.3 conversion

From: Nicolas Pujol <nicolaspujol_at_yahoo.com>
Date: Fri, 20 Apr 2007 14:37:27 -0700 (PDT)

Hi,

 I am working on a JAXB1.0 to 2.0 (2.1.3 to be
exact)conversion and something that used to work does
not work anymore. Specifically, I could provide an
implementation class where i had some additional logic
and have JAXB automagically create an instance of it.

I used to have this:

<jxb:bindings
node="//xs:complexType[@name='t_processType']">

                        <jxb:class name="ProcessType"
implClass="com.home.model.binding.MyProcessType"/>
</jxb:bindings>

So when i unmarshalled i could do :

 MyProcessType myType = (MyProcessType)
u.unmarshal(stream);

where I had this for class MyProcessType

public class MyProcessType extends
com.home.model.binding.impl.ProcessTypeImpl

and com.home.model.binding.impl.ProcessTypeImpl was
generated by jaxb.


I am trying to achieve something similar with JAXB2.0
and it is not working. What I did is to change
MyProcessType to:

public class MyProcessType extends ProcessType

However, the object returned by u.unmarshal(stream) is
of type ProcessType and NOT MyProcessType.

I don't understand because there is indeed a
corresponding objectFactory method that looks like
this :

public ProcessType createProcessType() {
        return new MyProcessType();
    }

though it does not seem to get called as the no-arg
constructor for MyProcessType() is not called ( i
tried putting in a sys.out)
In any case, any feedback on how to have
u.unmarshal(stream) return an object of type
MyProcessType would be great.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com