commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Prohaska <Andreas.Proha...@web.de>
Subject Re: [Betwixt] Using interfaces or abstract classes
Date Wed, 06 Aug 2003 20:38:30 GMT
Andreas Prohaska wrote:

> As you can guess the error happens when I try to deserialize the beans 
> again since betwixt is trying to instantiate an object of class Daemon 
> when it encounters the "daemon" tag. However, it should instantiate 
> the implementing class FSDaemon. I already tried to register the class 
> via
>
>    BeanReader.registerBeanClass("daemon", FSDaemon.class)
>
> but this didn't help.

Ahhh, looking at the betwixt sources I found out that I can directly 
call the Digesters methods and add my own rules like:

        beanReader.addObjectCreate("installation/daemons/daemon", 
"FSDaemon");
        beanReader.addCallMethod  
("installation/daemons/daemon/service", "setService", 0);
        beanReader.registerBeanClass("installation", FSInstallation.class);

With this workaround I can avoid the problem for the moment. However 
this is certainly not a nice solution, because now I have to know in 
advance what objects will be serialized at runtime. Well, thanks anyway...

Andreas



Mime
View raw message