commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: [digester] addSetNext call placement
Date Tue, 11 Mar 2003 17:27:58 GMT
On Tue, 11 Mar 2003, Erik Price wrote:

> Date: Tue, 11 Mar 2003 11:28:14 -0500
> From: Erik Price <eprice@ptc.com>
> Reply-To: Jakarta Commons Users List <commons-user@jakarta.apache.org>
> To: Jakarta Commons Users List <commons-user@jakarta.apache.org>
> Subject: [digester] addSetNext call placement
>
> Does it matter where you place the call to the "addSetNext" method of a
> Digester instance, as long as it's before the "parse" method call?
>
> i.e.:
>
> Digester dig = new Digester();
> dig.push(this);
> dig....
> dig....
> dig....
> dig.addSetNext("some/pattern", "addFoo");
> dig.parse(file);
>
>
> is the same as:
>
> Digester dig = new Digester();
> dig.push(this);
> dig.adSetNext("some/pattern", "addFoo");
> dig....
> dig....
> dig....
> dig.parse(file);
>

Ordering only matters among rules with the same pattern String -- they are
executed in the order they were registered.  So, if you're creating the
foo object before using the set next rule, you will want to register the
object create rule first.

For example, my rulesets are full of things like:

  digester.addObjectCreate("some/pattern", "com.mycompany.MyFoo");
  digester.addSetProperties("some/pattern");
  digester.addSetNext("some/pattern", "addFoo");

The rules for different patterns can be added in any order.

>
> ?
>
>
> Thanks,
>
> Erik

Craig

Mime
View raw message