Pawel,

Normally Castor likes to make sure it can "unmarshal" the marshalled
instance (round-trip: java->xml->java), but, if you only care about the
marshalling, then you can take a look at this tip, it should help:

http://www.brainopolis.com/castorwiki/Wiki.jsp?page=Constructable

--Keith


Pawel Rzepa wrote:
> 
> Hi all,
>    I have a problem regarding using Castor XML Mapping with interfaces.
> I try to marshall an interface and I can't do that. I've written the
> simple interface:
> public interface IMapped {
>      public String getName();
>      public void setName(String string);
> }
> and class that implement it.
> 
> When I marshall IMapped using default mapping everything works great.
> But when I use my own mapping:
> <mapping>
> <class name="IMapped">
> <field name="name" type="string"/>
> </class>
> </mapping>
> 
> I got the following exception:
> 
> org.exolab.castor.mapping.MappingException: The Java class IMapped is
> not constructable -- it does n
> ot contain a default public constructor
>         at
> org.exolab.castor.mapping.loader.ClassDescriptorImpl.<init>(ClassDescriptorImpl.java:152)
> ...
> 
> Did I do something wrong or does it the way Castor XML Mapping work? I
> understand that to unmarshall object it must be constructable (as
> mentioned in Castor documentation). But to marshall - what for?
> 
> Any help appreciated.
> 
> Regards,
>    Pawel Rzepa
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to