commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob Cash" <Rob.C...@nortelnetworks.com>
Subject Re: [Digester] Create an object using parent attribute
Date Fri, 25 Jun 2004 15:41:33 GMT
"Simon Kitching" <simon@ecnetwork.co.nz> wrote in message
news:1088123321.26657.37.camel@pcsimon...
[snip]
> How about this??
>
> public class ChildCreationFactory implements ObjectCreationFactory {
>   public Object createObject(Attributes x) {
>     ParentClass parent = (ParentClass) digester.peek();
>     String childClassName = parent.getChildClassName();
>
>     // create instance of child class and return it
>   }
> }
>
> digester.addObjectCreate("parent", ParentClass.class);
> digester.addSetProperties("parent");
> digester.addFactoryCreate("parent/child", new ChildCreationFactory());
> digester.addSetNext("parent/child");
>
>
> That looks much better...[I hope]
>

I think that this will do what I was looking for. Now to implement it...

Thanks for the pointers!

> Regards,
>
> Simon


Cheers,
Rob




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message