Note that there are some explanatory texts on larger screens.

plurals
  1. POMarshaling and Unmarshaling using Castor
    text
    copied!<p>I want to Marshal and unmarshal the list of my class objects say <code>java.util.List&lt;MyObject&gt;</code>. I am planning to use Castor for it, I will have to use the <strong>Castor-0.9.5.*.jar</strong> version.</p> <p>Additionally I have the XML Schema for my Marshaled object(<code>MyObject</code>). <code>MyObject</code> class does not have a default constructor, it only has a parametrized constructor which sets all fields. And there are no setter methods for any field in <code>MyObject</code> class. I can not modify <code>MyObject</code> class at all.</p> <p>Here is the snippet of <code>MyObject</code> class:</p> <pre><code>public class MyObject { private final SomeEnumType type; private final CutomObject custObjs[]; private final int index; private final String[] strs; private final int rows[]; // NOTE: This class also has getter methods for all the fields. // NOTE: There are NO setters methods and all fields are final public MyObject(SomeEnumType type, CutomObject custObjs[], int index, String strs[], int rows[]) { this.type = type; this.custObjs = custObjs; this.index = index; this.strs = strs; this.rows = rows; } } </code></pre> <p>My questions are:</p> <ol> <li>Is Castor the right choice for this scenario? If not what are better choices?</li> <li>How to created the Castor mapping in my case. I tried using <a href="http://o2xmapper.sourceforge.net/" rel="nofollow">O2XMapper</a> for this but it does not work as <code>MyObject</code> class does not have a default constructor?</li> <li>Is there a way to use the XML Schema of <code>MyObject</code> to generate Castor mapping.</li> <li>I could not find the <code>org.exolab.castor.xml.XMLContext</code> and <code>org.castor.xml.BackwardCompatibilityContext</code> classes in castor jar, Are they not part of Castor jar ?</li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload