JAXB unmarshaled object doesn't call ruby ctor

I have a JAXB class that is unmarshaled from XML. I’ve extended the
class in JRuby including a new constructor. It gets called under normal
creation but when I unmarshal the object from xml, the ruby constructor
gets ignored. Is there a way to set this up so that the ruby ctor does
gets called?

The background is I’m making a SOAP call to an outside supplier and I
want to save the object to mongoid without recreating a whole duplicate
model hierarchy. The Mongoid::Document mixin has an
initialize(attr=nil) ctor that doesn’t get called:

java_import ‘com.acme.MyJAXBClass’

class MyJAXBClass
include Mongoid::Document
embeds_one :my_other_obj
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs