commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Valery Silaev <vsil...@gmail.com>
Subject Re: [lang] Generic object factories
Date Sat, 26 Dec 2009 21:29:50 GMT
Let me draw an analogy with Adoby Flex:

There is an IFactory interface that servers for the same purpose and is
quite useful.

The problem it solves is the following:
Typically (in Flex) object initialization is not only constructor
invocation, but also setting certain properties and invoking different
init/setup-like methods.

I would say this is a case for Java too, so having ObjectFactory interface
makes sense for me -- it's used to define a contract to return fully
configured objects when configuration is more complex than just constructor
invocation.

Regards,
Valery Silaev


On Sat, Dec 26, 2009 at 10:22 PM, Ted Dunning <ted.dunning@gmail.com> wrote:

> This interface seems so generic as to be difficult to understand what the
> motivation is.
>
> I can see the point of a one method interface like Comparable, but how does
> ObjectFactory<T> help?  Is your goal documentation?  Name standardization?
> Reflection marker?
>
> On Sat, Dec 26, 2009 at 11:34 AM, Oliver Heger <
> oliver.heger@oliver-heger.de
> > wrote:
>
> > public interface ObjectFactory<T> {
> >    T create();
> > }
> > Does this make sense?
>
>
>
>
> --
> Ted Dunning, CTO
> DeepDyve
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message