File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Home Interface.. Abstract Factory or Factory Method pattern?

 
andy armstrong
Ranch Hand
Posts: 154
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the ejb home interface which pattern
is it?
 
Sanjay Raghavan
Ranch Hand
Posts: 148
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Definitely Factory Method...
Reason Abstract factory is used to create a family of dependent classes.
Factory method provides an interface for creating objects but lets subclasses decide which one to create.
Consider the following eg.
javax.ejb.EJBHome javax.ejb.EJBObject
| |
| |
/ \ / \
--- ---
| |
1. XxxHome gets instance of 1. Xxx
2. YyyHome gets instance of 2. Yyy
The appropriate concrete instance of EJBHome (our factory method generalization), in this case Xxx home or Yyy home (concrete factory) will create the appropriate remote reference object.

HTH.
 
Sanjay Raghavan
Ranch Hand
Posts: 148
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops...the diagram did not come out right...anyway XxxHome and YyyHome extend javax.ejb.EJBHome and Xxx and Yyy extend javax.ejb.EJBObject.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic