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

University email handler interface

The UniversityEmailHandler interface has two methods. The first method, setNextEmailHandler(), accepts a UniversityEmailHandler argument, which will be the next handler in the chain of authority. The second method, processEmailHandler(), is used if the email is processed by the current handler:

public interface UniversityEmailHandler {

public void setNextEmailHandler(UniversityEmailHandler emailHandler);

public void processEmailHandler(String emailText);

}

The preceding code explains the handler interface.