commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <>
Subject RE: how to add an object to a map by using a XML config file?
Date Sat, 12 Feb 2005 10:41:43 GMT
On Thu, 2005-02-10 at 10:04 -0300, Gorostegui Martin (SFN) wrote:
> Hi Simon,
> Thanks for the answer, but I think the "target stack offset" being
> used from a XML config file won´t be enough as I also need to pass the
> top object (created by an ObjectCreateRule) to the rule I´ll be using
> for adding to the map.

CallParamRule can be used with CallMethodRule to pass the top object on
the stack (at the time the CallParamRule fires) to the target method.

   Rule cmr = new CallMethodRule(-1, "put", 1);
   d.addRule("foo/bar", cmd);
   d.addCreateObject("foo/bar/baz", Baz.class);
   d.addCallParam("foo/bar/baz", 0, true);

should cause method "put" to be invoked on the root (oldest) object on
the stack, passing a Baz instance [assuming I haven't made any typos in
the above; it's not been tested].

Is this what you want to achieve?

By the way, "top posting" (where your reply is above the thing you are
replying to) really makes it hard to follow an email thread. Putting
your comments *below* the thing you are commenting on makes life much
easier for everyone concerned.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message