You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Simon Kitching <si...@ecnetwork.co.nz> on 2004/06/04 07:22:20 UTC

[digester] WithDefaultsRulesWrapper ATTN: Robert Donkin

Hi Robert,

Why exactly did you create the WithDefaultsRulesWrapper class? ie what
is the "use case" that caused you to create it?

I recently tried to associate a rule with the pattern "*", with the
intention that the rule would fire if-and-only-if no other rule matched
the input element. It doesn't work, probably because of this line in
RulesBase:
               if (key.startsWith("*/")) {
ie "*" isn't treated as a wildcard.

Wouldn't fixing this code in RulesBase to check for "*" then provide
exactly the same functionality as the new WithDefaultsRulesWrapper class
provides?

Regards,

Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [digester] WithDefaultsRulesWrapper ATTN: Robert Donkin

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
hi simon

i've forgotten the exact case for which i committed this more general 
solution but i remember the general reasoning.

decorators have some very powerful properties.

at the time, i had in mind some other interesting implementations which 
do not descend from BaseRules. RegexRules is one of those. i never got 
round to adding the others. one advantage of adding a decorator was 
that any Rules implementation could have defaults added.

another advantage of using a decorator is that the code is simple and 
the performance penalty is only paid by those who want to use this 
feature (rather than all users). in general, i'd prefer to keep 
BaseRules as quick and simple as possible (whatever that means :) and 
add extra features into other classes.

of course, that's not to say that the BaseRules dialect shouldn't be 
improved or added to. if this feature is a good addition, then let's 
add it to the language. whether it should go into Extended or Base 
should be a judgement call based on the penalty (in terms of 
performance and complexity) verses the functionality gained.

of course, i'd like to add again that's prefer it if you left it until 
after i've cut the release branch. i'll need to propose a vote 
approving the plan first so most likely this will be thursday before 
all the formalities are done and i can cut the branch.

- robert

On 4 Jun 2004, at 06:22, Simon Kitching wrote:

> Hi Robert,
>
> Why exactly did you create the WithDefaultsRulesWrapper class? ie what
> is the "use case" that caused you to create it?
>
> I recently tried to associate a rule with the pattern "*", with the
> intention that the rule would fire if-and-only-if no other rule matched
> the input element. It doesn't work, probably because of this line in
> RulesBase:
>                if (key.startsWith("*/")) {
> ie "*" isn't treated as a wildcard.
>
> Wouldn't fixing this code in RulesBase to check for "*" then provide
> exactly the same functionality as the new WithDefaultsRulesWrapper 
> class
> provides?
>
> Regards,
>
> Simon
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org