Robert,

I think my message was a little garbled..  Digester gives my brain a
workout!   What I did was this:

digester.addObjectCreate("configuration/properties",
"org.apache.commons.configuration.PropertiesConfiguration");
        digester.addSetProperties("configuration/properties");
        digester.addCallMethod("configuration/properties", "load");
        digester.addCallMethod("configuration/properties", "setBasePath", 1,
new String[] { "java.lang.String" });
        ObjectParamRule opr = new ObjectParamRule(0, getBasePath());
        digester.addRule("configuration/properties", opr);

Where getBasePath() brings in the value I want to set as the setBasePath
param...    I found an example in one of the test cases..

At least, I think this works!

Eric

-----Original Message-----
From: robert burrell donkin
[mailto:[EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 3:24 PM
To: Jakarta Commons Developers List
Subject: Re: [digester] How to provide CallMethodRule parameter from
code, no t xml?


hi eric

(if i understand what you mean correctly) i don't think that there's a way 
to do this. it should be pretty easy to add a new constructor to 
CallParamRule

CallParamRule(Object value, int paramIndex)

which passes that parameter to the CallMethod. i'll take a look at adding 
this when i get a little time or a patch would be gratefully received :)

- robert

On Thursday, March 20, 2003, at 07:08 PM, [EMAIL PROTECTED] wrote:

> Hi all,
>
> I have a factory class that is using digester to load up a series of
> objects:
>        digester.addObjectCreate(
>             "configuration/properties",
>             "org.apache.commons.configuration.PropertiesConfiguration");
>         digester.addSetProperties("configuration/properties");
>         digester.addCallMethod("configuration/properties", "load");
>         digester.addCallMethod(
>             "configuration/properties",
>             "setBasePath",
>             1,
>             new String[] {"java.lang.String"});
>
>
> However, for my property setBasePath, I want to pass in the value of the
> property not from XML, but from my factory method.  The basePath is not in
> the XML file currently.  If the value was in the XML, I would do:
>       digester.addCallParam("configuration/properties/prop1", 0);
>
> What am I missing?
>
> Eric Pugh


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

Reply via email to