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 2003/11/17 10:32:18 UTC

[digester] new rule SetNestedPropertiesRule

Hi,

Attached is a rule which behaves like a cross between SetPropertiesRule
and BeanPropertySetterRule-with-trailing-wildcard-match.

<point>
  <x>7</x>
  <y>8</y>
</point>

digester.addRule("point", new SetNestedPropertiesRule());

Note that the rule doesn't need to use ExtendedBaseRules with trailing
wildcard (which is very powerful but not very efficient). It is
configured with the pattern matching the "parent" element.

The implementation uses a trick developed for the plugins module:
inserting a "decorator" Rules object that performs custom matching to
detect the direct child elements.

Yes, this functionality can already be achieved with Digester, but this
is pretty efficient and convenient, and this configuration pattern is a
common one.


Opinions??

Regards,

Simon

Re: [digester] new rule SetNestedPropertiesRule

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

they're in now. i'd already added a (different) patch to add the test  
so i won't be applying yours.

- robert

On 19 Nov 2003, at 03:10, Simon Kitching wrote:

> On Wed, 2003-11-19 at 12:30, robert burrell donkin wrote:
>> hi simon
>>
>> just to let you know that i would have committed your patch but  
>> there's
>> a broken lock in cvs :(
>
> Thanks Robert.
>
> Since the new rule is considered acceptable, here's a patch that adds
> the tests to build.xml. Hope that CVS issue doesn't cause you too much
> headache..
>
> Cheers,
>
> Simon
> <nestedpropsrule- 
> test.patch>------------------------------------------------------------ 
> ---------
> 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


Re: [digester] new rule SetNestedPropertiesRule

Posted by Simon Kitching <si...@ecnetwork.co.nz>.
On Wed, 2003-11-19 at 12:30, robert burrell donkin wrote:
> hi simon
> 
> just to let you know that i would have committed your patch but there's 
> a broken lock in cvs :(

Thanks Robert.

Since the new rule is considered acceptable, here's a patch that adds
the tests to build.xml. Hope that CVS issue doesn't cause you too much
headache..

Cheers,

Simon

Re: [digester] new rule SetNestedPropertiesRule

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

just to let you know that i would have committed your patch but there's 
a broken lock in cvs :(

- robert

On 17 Nov 2003, at 09:34, Simon Kitching wrote:

> On Tue, 2003-11-18 at 11:32, Simon Kitching wrote:
>> Hi,
>>
>> Attached is a rule which behaves like a cross between 
>> SetPropertiesRule
>> and BeanPropertySetterRule-with-trailing-wildcard-match.
>
> I should mention that this rule comes in very useful when using the
> Plugins module. That module does not permit any wildcards in patterns
> below "plugin mount points". So the BeanPropertySetterRule + trailing
> wildcards solution cannot be used, but this solution can.
>
> 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


Re: [digester] new rule SetNestedPropertiesRule

Posted by Simon Kitching <si...@ecnetwork.co.nz>.
On Tue, 2003-11-18 at 11:32, Simon Kitching wrote:
> Hi,
> 
> Attached is a rule which behaves like a cross between SetPropertiesRule
> and BeanPropertySetterRule-with-trailing-wildcard-match.

I should mention that this rule comes in very useful when using the
Plugins module. That module does not permit any wildcards in patterns
below "plugin mount points". So the BeanPropertySetterRule + trailing
wildcards solution cannot be used, but this solution can.

Regards,

Simon


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