Hi,
I'm using castor-0.9.5.3 and I am trying to unmarshal xml to an object that has 
a list of enums, but I get this error:
java.lang.IllegalStateException: Java schema change: Class Foo can no longer be 
constructed: Foo

I tried using verify-constructable, but that doesn't seem to have any affect 
(perhaps because I have a list of enums?)

This is a simplified version of the class I am trying to map to.
Class Foo {
    public enum State implements blah.State<Foo> {
        StateA,
        StateB
    }

    private List<Foo.State> states;

    public void setStates(List<Foo.State> states) {
        this.states = states;
    }
}

Where blah.State is the following generic:
public interface State<T> {
    String name();
}


When I use this mapping 
   <class name="Foo" auto-complete="false">
       <map-to xml="FooXML" /> 
       <field name="states" collection="arraylist" type="Foo$State">
           <bind-xml name="Status" node="element"/>
       </field>               
   </class>

   <class name="Foo$State" verify-constructable="false" auto-complete="false">
       <map-to xml="Status" />
   </class>

It works fine when I limit Foo to one state and replace the list with a simple 
instance variable.  I stepped through the castor code and verify-constructable 
is getting set properly when the Mapping file is loaded.  During unmarshalling 
however, the UnmarshalHandler calls startElement on the state enum, it sees 
that the destination is neither an array, nor immutative, nor a primitive so it 
tries to create the object with a call to Types.newInstance().  This throws an 
instantiation exception which is converted to an IllegalStateException, and 
then to a SaxException.  I don't actually see where verifyConstructable 
interacts with the unmarshalling process.

Can anyone help point me in the right direction?

Thanks!

Vidya  

Reply via email to