Re: Is a static method sufficient to call it factory?
- From: Andrea Desole <news@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 28 Jul 2005 15:59:02 +0200
f.vivoli@xxxxxxxxx wrote:
Well, actually the getInstance returns always the same instance of the Factory class...
usually yes, but it doesn't have to. It can also return a subclass of Factory. If I understand correctly what you say
For subclassing I was meaning that the allocated objects do not necessarily belong to the same class hierarchy of the factory.
It depends on what you mean by "allocated object". If you mean the result of createClass then no, it doesn't have to be a factory subclass. It shouldn't be. But you didn't give any information about the return type of getInstance (I assume it's Factory) and createClass.
So, supposing that getInstance returns a Factory, then createClass is your factory method. Now getInstance can return a subclass of Factory, and that subclass can implement its own crateClass method. This is the idea of the factory method.
.
- References:
- Is a static method sufficient to call it factory?
- From: f . vivoli
- Re: Is a static method sufficient to call it factory?
- From: Andrea Desole
- Re: Is a static method sufficient to call it factory?
- From: f . vivoli
- Is a static method sufficient to call it factory?
- Prev by Date: Re: Java file extentions
- Next by Date: Re: Java Programmer Needed NY
- Previous by thread: Re: Is a static method sufficient to call it factory?
- Next by thread: Re: Is a static method sufficient to call it factory?
- Index(es):
Relevant Pages
|
|