Introduction to the chain of responsibility pattern of Java design pattern
•
Java
Chain of responsibility definition: chain of responsibility (COR) attempts to process a request with a series of classes. These classes are loosely coupled, and the only thing in common is to pass the request between them. In other words, when a request comes, class a will process it first. If it is not processed, it will be passed to class B for processing. If it is not processed, it will be passed to class C for processing. In this way, it will be passed down like a chain.
How to use the responsibility chain model although this paragraph is about how to use the COR, it also demonstrates what the COR is.
There is a handler interface:
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码