Abstract Factory Pattern
Overview
Provides an interface for creating families of related or dependent objects without specifying their concrete classes
Participants
- declares an interface for operations that create abstract product objects.
- this participant can be abstract class or interface.
- an interface for a type of Product object.
- this participant can be abstract class or interface.
- implements operations of AbstractFactory to create Concrete product objects.
- this participant can not be an interface.
Parameters
-
name of the instance attribute in factory, property enabled when the Factory as Singleton property is checked.
-
name of get method in factory, property enabled when the Factory as Singleton property is checked.
-
specify whether you want to use the Singleton pattern for generating the Factory.
-
when selected, will create special JavaDoc links in the code between pattern participants, describing
their relationships.
Applicability
Use the Abstract Factory pattern when
- a system should be independent of how its products are created, composed, and represented.
- a system should be configured with one of multiple families of products.
- a family of related product objects is designed to be used together, and you need to enforce their constraint.
- you want to provide a class library of products, and you want to reveal just their interfaces, not their implementations.