中介者模式(Mediator Pattern) 介绍用一个中介对象来封装一系列的对象交互.中介者使各对象不需要显式地相互引用,从而使其耦合松散,而且可以独立地改变它们之间的交互. 示例有一个Message实体类,某个对象对它的操作有Send()和Insert()方法,现在用一个中介对象来封装这一系列的对象交互. MessageModel using System; using System.Collections.Generic; using System.Text; namespace Pat…
来源:http://www.bjsxt.com/ 一.[GOF23设计模式]_中介者模式.同事协作类.内部类实现 package com.test.mediator; /** * 同事类的接口 */ public interface Department { void selfAction();//做本部门的事情 void outAction();//向总经理发出申请 } package com.test.mediator; public class Development implements…