Java Reference
In-Depth Information
return successor.handle(r);
}
return r;
}
abstract protected T handleWork(T input);
}
Figure 8.3 illustrates the chain of responsibility pattern in UML.
Figure 8.3. The chain of responsibility design pattern
Here you may recognize the template method design pattern, which we discussed in section
8.2.2 . The method handle provides an outline of how to deal with a piece of work. Different
kinds of processing objects can be created by subclassing the class ProcessingObject and by
providing an implementation for the method handleWork.
Let's look at example of how to use this pattern. You can create two processing objects doing
some text processing:
 
Search WWH ::




Custom Search