- 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.
推薦閱讀
- 輕松學大數據挖掘:算法、場景與數據產品
- Modern Programming: Object Oriented Programming and Best Practices
- 大數據可視化
- UDK iOS Game Development Beginner's Guide
- Oracle高性能自動化運維
- Python數據分析:基于Plotly的動態可視化繪圖
- Python醫學數據分析入門
- 數字媒體交互設計(初級):Web產品交互設計方法與案例
- 高維數據分析預處理技術
- PostgreSQL指南:內幕探索
- 編寫有效用例
- 數字IC設計入門(微課視頻版)
- R Object-oriented Programming
- Gideros Mobile Game Development
- 精通Neo4j