Mediator mode (Mediator)



 

GOF Intent: Encapsulate a series of object interactions with an intermediary object

 

Role:

Mediator: The mediator defines an interface for communicating with colleague objects

ConcreteMediator: To hold a reference to each colleague, or to hold a list of colleagues.

Colleague class (colleague): Holds the reference of the mediator. To communicate with other colleagues, you can check the communication of colleagues through the interface of the mediator.

 

Implementation points: The intermediary holds a list of colleagues, and provides a communication interface (to be able to find the designated colleagues), and the colleagues hold the reference of the middleman.

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326879296&siteId=291194637