- Hands-On Design Patterns with Java
- Dr. Edward Lavieri
- 134字
- 2021-06-24 14:58:04
Admin email handler
The AdminEmailHandler class extends the MainEmailHandler class. Unlike the other classes, it does not assign any keywords specific to the admin email handler. If an email is sent to this handler, the last one in the chain of responsibility, it will process the email and inform the user via the processEmailFinal() method:
public class AdminEmailHandler extends MainEmailHandler {
protected String[] keyWords() {
// Here it does not matter what the keywords are
return new String[0];
}
protected void processEmailFinal(String emailText) {
System.out.println("The Admin Team processed the email.");
}
@Override
public void setNextEmailHandler(UniversityEmailHandler emailHandler) {
}
}
The processEmailFinal() method just shown informs the user that the admin email handler took care of the received email.
This section featured the university email system's source code, demonstrating the chain of responsibility design pattern.
推薦閱讀
- 揭秘云計算與大數(shù)據(jù)
- 數(shù)據(jù)驅(qū)動:從方法到實踐
- 數(shù)據(jù)驅(qū)動設(shè)計:A/B測試提升用戶體驗
- Apache Kylin權(quán)威指南
- 探索新型智庫發(fā)展之路:藍迪國際智庫報告·2015(上冊)
- 數(shù)據(jù)庫應(yīng)用系統(tǒng)開發(fā)實例
- Visual Studio 2013 and .NET 4.5 Expert Cookbook
- 活用數(shù)據(jù):驅(qū)動業(yè)務(wù)的數(shù)據(jù)分析實戰(zhàn)
- Visual FoxPro數(shù)據(jù)庫技術(shù)基礎(chǔ)
- 利用Python進行數(shù)據(jù)分析(原書第2版)
- 數(shù)據(jù)指標體系:構(gòu)建方法與應(yīng)用實踐
- PostgreSQL高可用實戰(zhàn)
- Flume日志收集與MapReduce模式
- 從零進階!數(shù)據(jù)分析的統(tǒng)計基礎(chǔ)(第2版)
- 數(shù)據(jù)時代的品牌智造