- Hands-On Design Patterns with Java
- Dr. Edward Lavieri
- 89字
- 2021-06-24 14:58:03
Academic email handler
The AcademicEmailHandler class extends the MainEmailHandler class. It assigns the keywords specific to the academic email handler and contains the processEmailFinal() method:
public class AcademicEmailHandler extends MainEmailHandler {
protected String[] keyWords() {
// setup keywords for the receiver team
return new String[] {"academic"};
}
protected void processEmailFinal(String emailText) {
System.out.println("The Academic Team processed the email.");
}
@Override
public void setNextEmailHandler(UniversityEmailHandler emailHandler) {
}
}
The processEmailFinal() method of the AcademicEmailHandler class shown informs the user that the academic email handler took care of the received email.