commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <>
Subject Re: [digester] PathCallParamRule
Date Tue, 02 Mar 2004 22:16:08 GMT

On 2 Mar 2004, at 21:09, Simon Kitching wrote:

> Hi,
> I think we need a CallParamRule variant which saves the matching 
> tagname
> as a method call parameter. This mail was prompted by a user question
> about building a HashMap using this kind of data:
>   <item>
>     <foo>1</foo>
>     <bar>2</bar>
>   </item>
> where the tagnames within an item are not known in advance.
> There is in CVS a new class PathCallParamRule which passes the whole
> path. I suggest that we add a flag to this method to pass just the
> tagname rather than the whole path. Alternatively, we could have a
> completely separate rule for just the tag name.

either seems fine to me (though possible another rule might possible be 
a little easy for a user to find). anyone else have any views on this?

> On the subject of CallParamRule variants: they are getting a little
> messy now.
> I suggest that we adopt a naming standard of:
>  CallParamWithXXXRule
> for all call-param-rule variants, so that it is easier for users to 
> find
> the available param rules. This would mean renaming PathCallParamRule 
> to
> CallParamWithPathRule. I would also suggest creating a
> CallParamWithObjectRule which is a copy of ObjectCallParamRule, and
> marking ObjectCallParamRule as deprecated.

i think that tidying up the CallParam stuff is overdue.

the proposed naming scheme sounds pretty intuitive to me. if anyone 
disagrees, then now's a good time to jump in.

> Or even more alternatively, we could roll all existing param-related
> rule functionality into the CallParamRule, and have a constructor which
> takes some enum-like flag to say which behaviour we want:
>   digester.addCallParam(pattern, CallParamRule.TAGNAME, 0);
>   digester.addCallParam(pattern, CallParamRule.ATTR, 0);
>   digester.addCallParam(pattern, CallParamRule.BODY, 0);
>   digester.addCallParam(pattern, CallParamRule.MATCHPATH, 0);
> This would clean up the existing CallParamRule constructor API, which
> has grown rather ugly as features have been added.

i think either of these proposals sounds like definite improvements. i 
have a slight dislike of enum-like flags so i that

   digester.addCallParamWithTagName(pattern, 0);
   digester.addCallParamWithAttribute(pattern, 0);
   digester.addCallParamWithBody(pattern, 0);
   digester.addCallParamWithMatchingPath(pattern, 0);

might be better. i don't feel very strongly about this so i'd be 
interested to hear what other people think.

- robert

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message