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.dunn...@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.he...@oliver-heger.de
> > wrote:
>
> > public interface ObjectFactory<T> {
> >    T create();
> > }
> > Does this make sense?
>
>
>
>
> --
> Ted Dunning, CTO
> DeepDyve
>

Reply via email to