aspose file tools*
The moose likes Beginning Java and the fly likes Factory Methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Factory Methods" Watch "Factory Methods" New topic
Author

Factory Methods

vishal sodani
Ranch Hand

Joined: Aug 26, 2000
Posts: 127
Please explain the concept of factory methods!!
Rahul Mahindrakar
Ranch Hand

Joined: Jul 28, 2000
Posts: 1850
Hi,
This is a Gamma Et all pattern defined in the Design patterns book. Lets say we have a method defined like this.


An Object invoking the getMan method does not know which particular instance is created and is returned a Man. When he invokes walk on the Man Object returned he is returned 5 if the instance created is Rahul or 10 if the instance created is Sham. The method getman(..)
is the Factory.

------------------

Mahindrakar
IBM Application Server Forum Moderator
SCJP2
Eddy Chang
Greenhorn

Joined: Apr 05, 2001
Posts: 27
Here's an article at javaworld that explains factory methods that you might find helpful.
Factory methods:
How do you employ factory methods to your best advantage http://www.javaworld.com/javaworld/javaqa/2001-05/02-qa-0511-factory_p.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Factory Methods