首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

《有点模式》- 责任链(简单模拟1)

2012-09-04 
《有些模式》- 责任链(简单模拟1)package com.macrotea.responzchain.testimport com.macrotea.responzchai

《有些模式》- 责任链(简单模拟1)

package com.macrotea.responzchain.test;import com.macrotea.responzchain.chain.FilterChain;import com.macrotea.responzchain.handler.MessageHandler;import com.macrotea.responzchain.impl.HTMLFilter;import com.macrotea.responzchain.impl.HarmonyFilter;public class Mainer {public static void main(String[] args) {  String netText="<h1>哈哈</h1>我来到一个神奇的地方,这里有犀利哥,有大乡里,有奔跑哥,什么都有!";/*构造过滤器链*/FilterChain chain=new FilterChain();chain.appendFilter(new HTMLFilter()).appendFilter(new HarmonyFilter());/*传递给信息处理者*/MessageHandler msgHandler =new MessageHandler(chain);String clearText=msgHandler.doHandle(netText);System.out.println(clearText);}}

??

?

简单责任链设计模式!!

?

?

?

热点排行