commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Bourg" <sma...@lfjr.net>
Subject [digester] Alternate call method rule proposal
Date Mon, 12 Aug 2002 17:12:28 GMT
Hello,

I wrote a new rule for the digester based on the CallMethodRule rule, i
think it to could useful to integrate it in the digester code.

With the standard CallMethodRule the method invocation is delayed until
the closing tag is reached, in some cases it's needed to invoke the
method after parsing the opening tag (provided element's attributes are
the only parameters and the body is not used as a parameter), especially
if rules matching sub-elements require data set previously on the parent
objet.

The principle is to invoke the method from the last CallParamRule called
instead of the end() method of the CallMethodRule. To achieve this the
CallParamRule needs a reference to the CallMethodRule object, this is
done by pushing the rule object on the digester's stack in the begin()
method. The last CallParamRule pops the CallMethodRule and calls a
doMethodCall() method on it.

I'm not sure the CallMethodRule and CallParamRule classes can be changed
to allow this without breaking current uses of the Digester (especially
for calls using both element's attributes and element's body as
parameters). In doubt I wrote 2 rules derivated from the digester's
ones, EarlyCallMethodRule and EarlyCallParamRule, i'm attaching them to
this mail. If it's found worth for addition to the digester i'll be glad
to polish this up and submit an extensive patch.

Emmanuel Bourg


Mime
View raw message