Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it.
PerfectJPattern's componentized version of the Chain of Responsibility Pattern provides the following advantages:
IHandlerinstances may be configured with a
IChainStrategythat parameterize the Chain-continuation behavior. It was provided two concrete implementations
OnlyOneHandleStrategywhere the later is the use-case covered in the original GoF implementation and the default Strategy.
IParameterlessHandlerdefinitions: Providing both user-defined single-parameter request types and Chain that do not require any request parameter.
NullHandlerimplementation: that completely avoids dealing with null values as Chain stop condition.
AbstractParameterlessHandlerbase abstract types: that only require subtypes providing the Handler business