DEV Community

Cover image for Chain of Responsibility Pattern | Design Patterns in Java
coder4life
coder4life

Posted on

Chain of Responsibility Pattern | Design Patterns in Java

Behavioral design pattern: Watch a Java implementation of the Chain of Responsibility Pattern which passes a request/command along a chain of potential handlers/processors until one of them handles request. In this example a chain of logging objects can log to either file, database or console. The client sends a command to the chain and it runs down the chain until a processor can handle the requested logging type. Bonus info: The Chain of Responsibility Design Pattern is also one of the Gang of Four design patterns.

Discussion (0)