struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: Digester and Factory methods
Date Tue, 28 Aug 2001 00:05:41 GMT


On Fri, 24 Aug 2001, Tom Tibbetts wrote:

> Date: Fri, 24 Aug 2001 09:52:30 -0500
> From: Tom Tibbetts <ttibbetts@ecmc.org>
> Reply-To: struts-user@jakarta.apache.org
> To: struts-user@jakarta.apache.org
> Subject: Digester and Factory methods
>
> Greetings.  I'm using the digester to read a poor-person's DB and am
> wondering if there is a way for the digester to call my own factory methods
> for creating objects instead of using the Digester's addCreateObject
> method.  If there was a way of registering factory methods for object
> creation, that would be way cool.  Thanks, Tom Tibbetts
>

The current development branch of Digester in the jakarta-commons project
has just such a feature -- there is a new rule type called
FactoryCreateRule, to which you pass an object that implements
ObjectCreationFactory.  This works wonders, for example, when you need to
instantiate an object that does not have a zero-args constructor, or where
you *must* call an underlying factory method to create the thing, instead
of Class.newInstance().

Craig


Mime
View raw message