commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Yu <j...@scioworks.com>
Subject [digester][patch] CallMethodRule, CallParamRule and Digester
Date Mon, 16 Sep 2002 04:15:56 GMT

I have a use case which can't be done with the Digester's standard rules. 
(I hope I haven't overlooked Digester's API.) After some experiment, I 
realized I could make CallMethodRule/CallParamRule work with some 
enhancement. I think the use case is pretty common and generic.

The use case is like this: I need to call a 3rd party API

   Parent.add(Child child, Condition condition)

with the XML data:

   <parent>
     <child .../>
     <condition .../>
   </parent>

I can't use SetNextRule as it takes only one object from the stack.
CallMethodRule/CallParamRule comes close, but it allows only parameters 
coming from body texts or attributes, not generic objects from the stack.

So, I made the following changes to CallMethodRule/CallParamRule:
    * Changed the param stack frame from String[] to Object[]
    * Overloaded CallParamRule to configure it to get the parameter from 
the stack
    * Made CallParamRule stateless so that it can work probably in nesting
I've attached the zipped file of the diffs.

-- 
John Yu
Mime
View raw message