Can you give some concrete examples?
Also, nit-picking on the name, since everything that is created IS an Object,
having "Object" in the name is redundant IMO. This says the same:
public interface Factory<T> {
T create();
}
Gary
> -----Original Message-----
> From: Oliver Heger [mailto:[email protected]]
> Sent: Saturday, December 26, 2009 11:35
> To: Commons Developers List
> Subject: [lang] Generic object factories
>
> With Java 1.5 it is possible to define a generic interface for creating
> an object:
>
> public interface ObjectFactory<T> {
> T create();
> }
>
> This is a proposal to add such an interface to [lang] 3.0 with a couple
> of default implementations, e.g.
> - a ConstantObjectFactory returning always the same constant object,
> - a ReflectionObjectFactory which creates new instances of a given
> class
> using reflection
>
> Some Initializer classes in the concurrent package also deal with the
> creation of objects. They could implement this interface, too.
>
> Client classes that use this interface to create dependent objects
> would
> be pretty flexible. By specifying concrete factory implementations it
> is
> easy to configure the concrete objects they use and how they are
> created
> as well.
>
> Does this make sense?
> Oliver
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]