commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <si...@ecnetwork.co.nz>
Subject [digester] new rule SetNestedPropertiesRule
Date Mon, 17 Nov 2003 09:32:18 GMT
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

Mime
View raw message