You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by David Graham <gr...@yahoo.com> on 2003/09/09 06:22:02 UTC

[beanutils] BeanFactory Proposal

Some time ago I opened an enhancement ticket

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18087

for a BeanFactory class.  Currently it lives in the Mapper sandbox project
as ObjectFactory but, IMHO, it really belongs in a bean oriented package
like BeanUtils.  The whole point of the class is to allow configurable
(via a Map) object creation.  You pass it a logical name, it gives you an
instance of some Object.  It takes all the pain out of dynamic object
creation and is crucial to what packages like Mapper do.

Anyways, I'd appreciate it if a BeanUtils committer would comment on this.
 As always, I'll support the code should it make it into BeanUtils (it
already has some test cases :-).

Source:
http://cvs.apache.org/viewcvs.cgi/jakarta-commons-sandbox/mapper/src/share/org/apache/commons/mapper/util/ObjectFactory.java?rev=HEAD&content-type=text/vnd.viewcvs-markup

Javadoc:
http://jakarta.apache.org/commons/sandbox/mapper/apidocs/org/apache/commons/mapper/util/ObjectFactory.html

Thanks,
David

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Re: [beanutils][lang] BeanFactory Proposal

Posted by David Graham <gr...@yahoo.com>.
--- Stephen Colebourne <sc...@btopenworld.com> wrote:
> [lang] did have a Factory class in it for a while, but in the end we
> decided
> that the versions in [collections] and [functor] covered things better
> than
> a generic case in [lang] could.

I didn't see a Functor factory class after skimming the javadocs.  The
Factory interface in Collections doesn't support what's needed by
ObjectFactory not to mention the functionality isn't collections related.

> 
> However, there has been talk of kicking off a [convert] project to
> handle
> solely the issue of converting one type to another type. Typcially this
> would be String to Object and vice versa, but Bean creation could fall
> here
> too.

What's the correlation between data conversion and dynamic bean creation? 
IMHO, the best place for ObjectFactory is BeanUtils or Lang.

Thanks for the feedback.

David

> 
> Obviously [convert] steps on the toes of the [beanutils] conversion
> code.
> So, we'll have to see if it ever happens.
> 
> Stephen
> 
> 
> ----- Original Message -----
> From: "robert burrell donkin" <ro...@blueyonder.co.uk>
> > i did take a look at this a little while ago and i'm fairly positive
> about
> > the proposal. but there's a huge backlog of beanutils stuff that
> really
> > needs looking at and thinking about (including your proposal).
> >
> > on issue (that i think has been raised in the past) is that the
> factory is
> > not just about beans - it seems to me like a more general utility
> class.
> i'
> > ve cc'd lang so that they can help to settle this issue.
> >
> > comments anyone?
> >
> > - robert
> >
> > On Tuesday, September 9, 2003, at 05:22 AM, David Graham wrote:
> >
> > > Some time ago I opened an enhancement ticket
> > >
> > > http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18087
> > >
> > > for a BeanFactory class.  Currently it lives in the Mapper sandbox
> project
> > > as ObjectFactory but, IMHO, it really belongs in a bean oriented
> package
> > > like BeanUtils.  The whole point of the class is to allow
> configurable
> > > (via a Map) object creation.  You pass it a logical name, it gives
> you
> an
> > > instance of some Object.  It takes all the pain out of dynamic
> object
> > > creation and is crucial to what packages like Mapper do.
> > >
> > > Anyways, I'd appreciate it if a BeanUtils committer would comment on
> this.
> > >  As always, I'll support the code should it make it into BeanUtils
> (it
> > > already has some test cases :-).
> > >
> > > Source:
> > > http://cvs.apache.org/viewcvs.cgi/jakarta-commons-
> > >
>
sandbox/mapper/src/share/org/apache/commons/mapper/util/ObjectFactory.java?
> > > rev=HEAD&content-type=text/vnd.viewcvs-markup
> > >
> > > Javadoc:
> > >
>
http://jakarta.apache.org/commons/sandbox/mapper/apidocs/org/apache/commons/
> > > mapper/util/ObjectFactory.html
> > >
> > > Thanks,
> > > David
> > >
> > > __________________________________
> > > Do you Yahoo!?
> > > Yahoo! SiteBuilder - Free, easy-to-use web site design software
> > > http://sitebuilder.yahoo.com
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Re: [beanutils][lang] BeanFactory Proposal

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On Wednesday, September 10, 2003, at 12:00 AM, Stephen Colebourne wrote:

> My vision for [convert] is a very small core (2 or 3 classes) plus 
> pluggable
> convertors. Not an unusual design, however [convert] should package the
> convertors into a core and optional jar, or alternatively just list some
> dependencies as optional. That way adding a dependency to a third party 
> date
> time library like Joda, or to [lang] for Enums or for JDK1.4 for Currency
> becomes simpler.

my experience is that the user demand is for a comprehensive 
out-of-the-box solution. they want folks such as yourself to do the hard 
thinking so they don't have to. i'm working on conversions for betwixt at 
the moment so maybe i'll try to feed back analysis of some of the wrinkles 
back here.

> Whether [beanutils] ever depends on a [convert] is a different matter of
> course.

i think that beanutils will end up with optional dependencies concentrated 
in a org,apache.commons.beanutils.optional directory. (a bit like ant.) 
but i don't have the energy to push beanutils forward and all the other 
stuff at the moment so it'll have to wait.

- robert


Re: [beanutils][lang] BeanFactory Proposal

Posted by Stephen Colebourne <sc...@btopenworld.com>.
My vision for [convert] is a very small core (2 or 3 classes) plus pluggable
convertors. Not an unusual design, however [convert] should package the
convertors into a core and optional jar, or alternatively just list some
dependencies as optional. That way adding a dependency to a third party date
time library like Joda, or to [lang] for Enums or for JDK1.4 for Currency
becomes simpler.

Whether [beanutils] ever depends on a [convert] is a different matter of
course.

Stephen

----- Original Message -----
From: "robert burrell donkin" <ro...@blueyonder.co.uk>
> On Tuesday, September 9, 2003, at 11:25 PM, Stephen Colebourne wrote:
>
> > [lang] did have a Factory class in it for a while, but in the end we
> > decided
> > that the versions in [collections] and [functor] covered things better
> > than
> > a generic case in [lang] could.
> >
> > However, there has been talk of kicking off a [convert] project to
handle
> > solely the issue of converting one type to another type. Typcially this
> > would be String to Object and vice versa, but Bean creation could fall
> > here
> > too.
> >
> > Obviously [convert] steps on the toes of the [beanutils] conversion
code.
> > So, we'll have to see if it ever happens.
>
> i'm not too sure about that. there have been frequent requests from
> beanutils users for more comprehensive conversion but i've observed that
> there's a lack of agreement about what this actually means. so, i've come
> to the conclusion that it'd be better for beanutils to support basic
> conversions but allow different implementations to be plugged in.
>
> in particular, i think that people would like a component that offers a
> solution including the very thorny subject of dates. i have a feeling that
> including this in beanutils would involve drifting away from the tight
> focus that good commons components display.
>
> - robert
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


Re: [beanutils][lang] BeanFactory Proposal

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On Tuesday, September 9, 2003, at 11:25 PM, Stephen Colebourne wrote:

> [lang] did have a Factory class in it for a while, but in the end we 
> decided
> that the versions in [collections] and [functor] covered things better 
> than
> a generic case in [lang] could.
>
> However, there has been talk of kicking off a [convert] project to handle
> solely the issue of converting one type to another type. Typcially this
> would be String to Object and vice versa, but Bean creation could fall 
> here
> too.
>
> Obviously [convert] steps on the toes of the [beanutils] conversion code.
> So, we'll have to see if it ever happens.

i'm not too sure about that. there have been frequent requests from 
beanutils users for more comprehensive conversion but i've observed that 
there's a lack of agreement about what this actually means. so, i've come 
to the conclusion that it'd be better for beanutils to support basic 
conversions but allow different implementations to be plugged in.

in particular, i think that people would like a component that offers a 
solution including the very thorny subject of dates. i have a feeling that 
including this in beanutils would involve drifting away from the tight 
focus that good commons components display.

- robert


Re: [beanutils][lang] BeanFactory Proposal

Posted by Stephen Colebourne <sc...@btopenworld.com>.
[lang] did have a Factory class in it for a while, but in the end we decided
that the versions in [collections] and [functor] covered things better than
a generic case in [lang] could.

However, there has been talk of kicking off a [convert] project to handle
solely the issue of converting one type to another type. Typcially this
would be String to Object and vice versa, but Bean creation could fall here
too.

Obviously [convert] steps on the toes of the [beanutils] conversion code.
So, we'll have to see if it ever happens.

Stephen


----- Original Message -----
From: "robert burrell donkin" <ro...@blueyonder.co.uk>
> i did take a look at this a little while ago and i'm fairly positive about
> the proposal. but there's a huge backlog of beanutils stuff that really
> needs looking at and thinking about (including your proposal).
>
> on issue (that i think has been raised in the past) is that the factory is
> not just about beans - it seems to me like a more general utility class.
i'
> ve cc'd lang so that they can help to settle this issue.
>
> comments anyone?
>
> - robert
>
> On Tuesday, September 9, 2003, at 05:22 AM, David Graham wrote:
>
> > Some time ago I opened an enhancement ticket
> >
> > http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18087
> >
> > for a BeanFactory class.  Currently it lives in the Mapper sandbox
project
> > as ObjectFactory but, IMHO, it really belongs in a bean oriented package
> > like BeanUtils.  The whole point of the class is to allow configurable
> > (via a Map) object creation.  You pass it a logical name, it gives you
an
> > instance of some Object.  It takes all the pain out of dynamic object
> > creation and is crucial to what packages like Mapper do.
> >
> > Anyways, I'd appreciate it if a BeanUtils committer would comment on
this.
> >  As always, I'll support the code should it make it into BeanUtils (it
> > already has some test cases :-).
> >
> > Source:
> > http://cvs.apache.org/viewcvs.cgi/jakarta-commons-
> >
sandbox/mapper/src/share/org/apache/commons/mapper/util/ObjectFactory.java?
> > rev=HEAD&content-type=text/vnd.viewcvs-markup
> >
> > Javadoc:
> >
http://jakarta.apache.org/commons/sandbox/mapper/apidocs/org/apache/commons/
> > mapper/util/ObjectFactory.html
> >
> > Thanks,
> > David
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! SiteBuilder - Free, easy-to-use web site design software
> > http://sitebuilder.yahoo.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


Re: [beanutils][lang] BeanFactory Proposal

Posted by David Graham <gr...@yahoo.com>.
--- robert burrell donkin <ro...@blueyonder.co.uk> wrote:
> hi david
> 
> i did take a look at this a little while ago and i'm fairly positive
> about 
> the proposal. but there's a huge backlog of beanutils stuff that really 
> needs looking at and thinking about (including your proposal).
> 
> on issue (that i think has been raised in the past) is that the factory
> is 
> not just about beans - it seems to me like a more general utility class.
> i'
> ve cc'd lang so that they can help to settle this issue.
> 
> comments anyone?

I proposed it in BeanUtils because JavaBeans must have a no-arg
constructor to be dynamically created.  ObjectFactory relies on this fact
to create instances.  I agree that Lang could also be a suitable place for
ObjectFactory.

David

> 
> - robert
> 
> On Tuesday, September 9, 2003, at 05:22 AM, David Graham wrote:
> 
> > Some time ago I opened an enhancement ticket
> >
> > http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18087
> >
> > for a BeanFactory class.  Currently it lives in the Mapper sandbox
> project
> > as ObjectFactory but, IMHO, it really belongs in a bean oriented
> package
> > like BeanUtils.  The whole point of the class is to allow configurable
> > (via a Map) object creation.  You pass it a logical name, it gives you
> an
> > instance of some Object.  It takes all the pain out of dynamic object
> > creation and is crucial to what packages like Mapper do.
> >
> > Anyways, I'd appreciate it if a BeanUtils committer would comment on
> this.
> >  As always, I'll support the code should it make it into BeanUtils (it
> > already has some test cases :-).
> >
> > Source:
> > http://cvs.apache.org/viewcvs.cgi/jakarta-commons-
> >
>
sandbox/mapper/src/share/org/apache/commons/mapper/util/ObjectFactory.java?
> > rev=HEAD&content-type=text/vnd.viewcvs-markup
> >
> > Javadoc:
> >
>
http://jakarta.apache.org/commons/sandbox/mapper/apidocs/org/apache/commons/
> > mapper/util/ObjectFactory.html
> >
> > Thanks,
> > David
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! SiteBuilder - Free, easy-to-use web site design software
> > http://sitebuilder.yahoo.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Re: [beanutils][lang] BeanFactory Proposal

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
hi david

i did take a look at this a little while ago and i'm fairly positive about 
the proposal. but there's a huge backlog of beanutils stuff that really 
needs looking at and thinking about (including your proposal).

on issue (that i think has been raised in the past) is that the factory is 
not just about beans - it seems to me like a more general utility class. i'
ve cc'd lang so that they can help to settle this issue.

comments anyone?

- robert

On Tuesday, September 9, 2003, at 05:22 AM, David Graham wrote:

> Some time ago I opened an enhancement ticket
>
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18087
>
> for a BeanFactory class.  Currently it lives in the Mapper sandbox project
> as ObjectFactory but, IMHO, it really belongs in a bean oriented package
> like BeanUtils.  The whole point of the class is to allow configurable
> (via a Map) object creation.  You pass it a logical name, it gives you an
> instance of some Object.  It takes all the pain out of dynamic object
> creation and is crucial to what packages like Mapper do.
>
> Anyways, I'd appreciate it if a BeanUtils committer would comment on this.
>  As always, I'll support the code should it make it into BeanUtils (it
> already has some test cases :-).
>
> Source:
> http://cvs.apache.org/viewcvs.cgi/jakarta-commons-
> sandbox/mapper/src/share/org/apache/commons/mapper/util/ObjectFactory.java?
> rev=HEAD&content-type=text/vnd.viewcvs-markup
>
> Javadoc:
> http://jakarta.apache.org/commons/sandbox/mapper/apidocs/org/apache/commons/
> mapper/util/ObjectFactory.html
>
> Thanks,
> David
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>