You can set your own factories on Castor. Have a look at 

http://jira.codehaus.org/browse/CASTOR-1669

for a recent conversation on setting custom object factories on the
Unmarshaller.

Werner

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Sent: Donnerstag, 21. Dezember 2006 14:54
> To: [email protected]
> Subject: [castor-user] Create instance with factory-method
> 
> Hi,
> 
> I have some classes I need to marshall/unmarshall. These are 
> simple autogenerated beans with an abstract "frontend" that 
> contains setters and getters for all properties. 
> Instantiation is handled through static factory methods. I 
> can't change this implementation. I can, however, choose 
> whatever format is convenient for the XML instance document.
> 
> I pretty much have the following:
> 
> abstract class MyBean {
>   public void setFoo(String foo);
>   public String getFoo();
> }
> 
> ..Which is then implemented by MyBeanImpl. Instances are 
> created with MyBean's internal factory class:
> MyBean bean = MyBean.Factory.newInstance();
> 
> How can I express this in a mapping? Create-method attribute 
> seems to deal with something else entirely (cf. 
> create-method: Factory method for instantiation of FieldHandler).
> 
> Chapter 5. xsi:types of the documentation takes me part of 
> the way, but this seems to still require that the 
> implementing class has an empty constructor. How can I use a 
> (no-arg) factory-method instead? Is there a simple way to do 
> this that I'm overlooking?
> 
> 
> --
> Regards,
> Audun
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
> 
>     http://xircles.codehaus.org/manage_email
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to