commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <>
Subject Re: [digester] i'd like to contribute - here's my new feature idea
Date Thu, 12 Dec 2002 22:41:25 GMT
hi sean

by all means, submit a patch.

but i'd prefer an attribute name to be passed in rather than using the 
first attribute. (i have a feeling that the order of attributes can be 
parser dependent.) when the attribute name isn't present, then just don't 
create anything. since ObjectCreateRule already has a constructor taking a 
string, then maybe i'd add a factory method that pass a null classname in 
the two string constructor. you'll need to add a test for null's into the 
body method.

add the digester method as you said.

also, please supply a unit test for this new feature. we use junit 
( our existing test cases live in src/test.

good luck!

- robert

On Thursday, December 12, 2002, at 09:27 PM, Sean Schofield wrote:

> So what if I wrote a patch to deal with this limitation (I described such 
> a patch in an earlier reply but it didn't seem to make it to the list).  
> The patch would be as follows:
> - Add a no-argument constructor to ObjectCreateRule
> - Modify the begin() method of ObjectCreateRule so that if there is no 
> classname and no name for an attribute for the classname (as would be the 
> case if you used the no-arg constructor), then use the first attribute 
> (if available) as the classname.  If that's not available then just 
> continue on and let the existing exception handling take over.
> - Modify Digester by adding an 'addObjectCreate(String pattern)' method 
> that would create the rule using the new no-arg constructor for 
> ObjectCreateRule
> What do you guys think?  I'd like to write the patch if it sounds 
> agreeable to the group.
> Regards,
> Sean
>> hi sean
>> (if i've understood you right) then i think that this functionality 
>> exists
>> already (or very nearly does).
>> take a look at the ObjectCreateRule(String classname, String 
>> attributeName)
>> . this will create an object who class name is given in an attribute of
>> the xml. at the moment, you have to specify a class name (which is used 
>> as
>> a default class to construct if the attribute isn't present) but it 
>> should
>> be very easy to create a patch which eases this restriction.
>> but don't let that put you off if you think you have a better solution.
> [... snip ...]
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.
> org>
> For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.
> org>

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

View raw message