Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 73333 invoked from network); 3 Mar 2004 22:12:10 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 3 Mar 2004 22:12:10 -0000 Received: (qmail 37052 invoked by uid 500); 3 Mar 2004 22:11:44 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 36948 invoked by uid 500); 3 Mar 2004 22:11:44 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 36870 invoked from network); 3 Mar 2004 22:11:43 -0000 Received: from unknown (HELO smtp-out2.blueyonder.co.uk) (195.188.213.5) by daedalus.apache.org with SMTP; 3 Mar 2004 22:11:43 -0000 Received: from [10.0.0.2] ([82.38.65.173]) by smtp-out2.blueyonder.co.uk with Microsoft SMTPSVC(5.0.2195.5600); Wed, 3 Mar 2004 22:11:45 +0000 Mime-Version: 1.0 (Apple Message framework v612) In-Reply-To: References: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Message-Id: Content-Transfer-Encoding: quoted-printable From: robert burrell donkin Subject: Re: [Digester] New rules Date: Wed, 3 Mar 2004 22:11:44 +0000 To: "Jakarta Commons Developers List" X-Mailer: Apple Mail (2.612) X-OriginalArrivalTime: 03 Mar 2004 22:11:45.0866 (UTC) FILETIME=[842A0AA0:01C4016C] X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N On 3 Mar 2004, at 08:41, J=F6rg Schaible wrote: > Hi folks, > > what about adding new rules to digester? In my project I have two=20 > 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=20= > a map. The map can be provided from the outside or is expected at the=20= > given stack position (generated by a previous rule). The key is=20 > requested as property from the top level element using the=20 > 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[] {=20= > 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=20 > stack. The rule was not realized as Parameter rule, since the API=20 > prohibits the call of peekParams and pushParams (package scope instead=20= > of protected). See also Alex' mail about the subject. i'm a bit confused by this last statement. i think that peekParams and=20= pushParams are public (at least in the CVS version). > Example: > digester.addRule("data/item/time", new DateFormatterRule(new=20 > 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=20= been published elsewhere then all you need to do is to post them to=20 this list (probably in a zip or a tar) in an email expressing your=20 intention to donate them to the ASF. (or you could create a enhancement=20= 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