commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <robertburrelldon...@blueyonder.co.uk>
Subject Re: [Digester] New rules
Date Wed, 03 Mar 2004 22:11:44 GMT
On 3 Mar 2004, at 08:41, Jörg Schaible wrote:

> Hi folks,
>
> what about adding new rules to digester? In my project I have two 
> rules I can share:
>
> 1) AddToMapRule
>
> Ctors:
>     AddToMapRule(int stackPosition, String key)
>     AddToMapRule(Map map, String key)
>
> The rule will peek the top level element of the stack and put it into 
> a map. The map can be provided from the outside or is expected at the 
> given stack position (generated by a previous rule). The key is 
> requested as property from the top level element using the 
> PropertyUtils.
>
> Example:
>     digester.addObjectCreate("data", HashMap.class);
>     digester.addSetNext("data", "setItems");
>     digester.addObjectCreate("data/item", Item.class);
>     digester.addRule("data/item", new AddToMapRule(1, "id"));
>     digester.addCallMethod("data/item/id", "setId", 0, new Class[] { 
> Integer.class });
>     digester.addCallMethod("data/item/origin", "setOrigin", 0);
>
>
> 2) DateFormatterRule
>
> Ctors:
>     DateFormatterRule(DateFormat format)
>
> The rule is used to convert an entry to a Date and push it onto the 
> stack. The rule was not realized as Parameter rule, since the API 
> prohibits the call of peekParams and pushParams (package scope instead 
> of protected). See also Alex' mail about the subject.

i'm a bit confused by this last statement. i think that peekParams and 
pushParams are public (at least in the CVS version).

> Example:
>     digester.addRule("data/item/time", new DateFormatterRule(new 
> SimpleDateFormat("yyyy/MM/dd hh:mm:ss"));
>     digester.addSetNext("data/item/time", "setTime");
>
>
> All of the rules support toString, the logger and have unit tests.

that ticks all my boxes :)

> Are you interested and what do I have to do for the donation?

AIUI so long as you own the copyright to these works and they have not 
been published elsewhere then all you need to do is to post them to 
this list (probably in a zip or a tar) in an email expressing your 
intention to donate them to the ASF. (or you could create a enhancement 
request in bugzilla and attach the code if that's easier.)

- robert

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


Mime
View raw message