官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 赞皇县| 天柱县| 长海县| 成武县| 榆树市| 宁明县| 武义县| 高密市| 舟曲县| 济南市| 兴文县| 吉木萨尔县| 邻水| 贵州省| 定襄县| 浠水县| 南部县| 图们市| 台南市| 贵溪市| 宜春市| 洪雅县| 天柱县| 连州市| 定安县| 高阳县| 淮安市| 靖宇县| 恩施市| 响水县| 科尔| 武胜县| 柘城县| 富阳市| 怀仁县| 舒城县| 温州市| 任丘市| 阳东县| 汪清县| 沿河|