Hands-On Design Patterns with Java
上QQ阅读APP看书,第一时间看更新

Finance email handler

The FinanceEmailHandler class extends the MainEmailHandler class. It assigns the keywords specific to the finance email handler and contains the processEmailFinal() method:

public class FinanceEmailHandler extends MainEmailHandler {

protected String[] keyWords() {
// setup keywords for the receiver team
return new String[] {"financial", "student aid", "tuition"};
}

protected void processEmailFinal(String emailText) {
System.out.println("The Finance Team processed the email.");
}

@Override
public void setNextEmailHandler(UniversityEmailHandler emailHandler) {

}
}

The processEmailFinal() method just shown informs the user that the finance email handler took care of the received email.