commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <si...@ecnetwork.co.nz>
Subject Re: AW: Re: Réf. : AW: [digester] interface and setter
Date Mon, 01 Sep 2003 07:56:27 GMT
Bonjour, Nicolas.

The CallMethodRule always operates on the top object on the
object-stack. If you have the rules:

 * digester.addFactoryCreate("acces/reader", ....)
 * digester.addCallMethod("acces/reader", ...)

then the top object on the stack will be the object your factory method
has just created. This is why you are getting the "no such method"
problem; there is no setReader method on the object returned by your
factory.

The SetNextRule is exactly what you need to use here; it operates on the
second-to-top object on the stack, passing the top object on the stack.
This is exactly what is needed for building parent->child relationships.

CallMethodRule is for populating attributes of a class with data
extracted from xml attributes, and from text fields within subelements,
not for building parent->child relations.

I don't understand why you think SetNextRule is not an elegant
solution....

> >
> > At the moment I found an alternative which work. I use
> > digester.addSetNext( "acces/reader", "setReader" ); rather than an
> > addCallMethod . It is a fonctionnal solution but not really elegant.

Bonne chance avec ton projet..et avec Digester!


Simon


Mime
View raw message