Java Reference
In-Depth Information
6
WHAT'S IN THIS CHAPTER?
What the factory pattern is and why you need it
How to implement the various l avors of the factory pattern: the
factory method and the abstract factory
How to implement the factory pattern in Java EE using the
@Producers and @Inject annotations
How to create custom annotations and the @Qualii er to
disambiguate concrete implementations
WROX.COM CODE DOWNLOADS FOR THIS CHAPTER
The wrox.com code download for this chapter is found a t www.wrox.com/go/
projavaeedesignpatterns on the Download Code tab. The code is in the Chapter 06
download and individually named according to the names throughout the chapter.
The factory design pattern is one of the widely used core design patterns in modern
programming languages. It is used not only by web and application developers, but by the
developers of run times and frameworks such as Java and Spring.
The factory pattern has two variations: the factory method and the abstract factory. The
intent of these patterns is the same: to provide an interface for creating families of related or
dependent objects without specifying their concrete classes. This chapter introduces you to
both of these variations and shows you examples of how to implement them.
You w i ll see how the factory pattern has been implemented in Java SE, how that differs from
its implementation in Java EE, and how it takes advantage of context dependency injection.
 
Search WWH ::




Custom Search