On Fri, 2006-12-01 at 16:24 -0800, Dmitry Beransky wrote:
> > The section titled
> >  "How do I get CallMethodRule to fire before SetNextRule?"
> > might be what you need..
> 
> thanks.  it did help.  I had to replace addSetProperties with
> addCallMethod, so the final sequence of rules now looks like:
> 
>         digester.addObjectCreate("*/menu", "javax.swing.JMenu", "class");
>         digester.addObjectCreate("*/menu/item",
> "javax.swing.JMenuItem", "class");
>         digester.addObjectCreate("*/menu/item/action", null, "class");
>         digester.addCallMethod("*/menu/item", "setText", 1, new
> Class[]{String.class});
>         digester.addCallParam("*/menu/item/", 0, "title");
>         digester.addSetNext("*/menu/item/action", "setAction");
>         digester.addSetNext("*/menu/item", "add");
> 
> wow, this feels like such a hack to me, though.  Is this the only way
> to get the behavior I want?

The fact that the setAction method on your class resets the title
property could also be considered "a hack" :-)

You are always free to write a Rule variant that does exactly what you
want; Digester is explicitly designed to allow custom rule classes to be
used.

Regards,

Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to