Switch branches/tags
Nothing to show
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
CarForSale.java
CarItemForSaleConcreteCreator.java
GuitarForSale.java
GuitarItemForSaleConcreteCreator.java
ItemForSale.java
ItemForSaleCreator.java
README.md
TestListForSale.java

README.md

DESIGN PATTERN - FACTORY METHOD

TYPE - CREATIONAL

The Factory Method pattern

All factory patterns encapsulate object creation. The Factory Method Pattern encapsulates object creation by letting subclasses decide what objects to create.

Factory pattern is most suitable where there is some complex object creation steps are involved. To ensure that these steps are centralized and not exposed to composing classes, factory pattern should be used.

Examples of the Factory Method Pattern in the JDK include

java.util.Calendar#getInstance() java.util.ResourceBundle#getBundle() java.text.NumberFormat#getInstance() java.nio.charset.Charset#forName() java.net.URLStreamHandlerFactory#createURLStreamHandler(String)