Описание тега multiton

The Multiton pattern is a creational design pattern. This pattern expands on the singleton concept to manage a fixed number of instances of the Multiton class. This typically done with a map of named instances as key-value pairs.

The Multiton pattern is a design pattern similar to the singleton, which allows only one instance of a class to be created. The Multiton pattern expands on the singleton concept to manage a fixed number of instances. This typically done with a map of named instances as key-value pairs.

Rather than having a single instance per application (e.g. the application object itself in many programming languages) the Multiton pattern provided a fixed set of instances.

A simple example for a Multiton class may be the class Weekday, which allows just seven instances named monday, tuesday, wednesday, thursday, friday, saturday, and sunday. This class keeps its constructor private, and allows access to the seven instances by one class method (e.g. weekdayByName()) or seven class methods (one for each weekday).

Reference wikipedia