2015-08-13 23:54:40 +02:00
|
|
|
---
|
|
|
|
layout: pattern
|
|
|
|
title: Multiton
|
|
|
|
folder: multiton
|
2015-08-15 18:03:05 +02:00
|
|
|
permalink: /patterns/multiton/
|
2015-08-20 21:40:07 +02:00
|
|
|
categories: Creational
|
2015-12-28 15:52:44 +02:00
|
|
|
tags:
|
|
|
|
- Java
|
|
|
|
- Difficulty-Beginner
|
2015-08-13 23:54:40 +02:00
|
|
|
---
|
|
|
|
|
2016-04-06 20:37:02 +03:00
|
|
|
## Also known as
|
|
|
|
Registry
|
|
|
|
|
2016-01-03 21:14:30 +01:00
|
|
|
## Intent
|
|
|
|
Ensure a class only has limited number of instances, and provide a
|
2015-08-13 23:54:40 +02:00
|
|
|
global point of access to them.
|
|
|
|
|
|
|
|

|
|
|
|
|
2016-01-03 21:14:30 +01:00
|
|
|
## Applicability
|
|
|
|
Use the Multiton pattern when
|
2015-08-13 23:54:40 +02:00
|
|
|
|
2015-08-15 18:03:05 +02:00
|
|
|
* there must be specific number of instances of a class, and they must be accessible to clients from a well-known access point
|