deferred class CHAIN_OF_RESPONSIBILITY

Features exported to INTERNALS_HANDLER

The Chain Of Responsibility Design Pattern reified. Such a chain is made of handlers you can add or remove at your leisure.

The Chain itself is a Command (see that Design Pattern). Executing that command looks for a handler that can handle a request, and let it handle that request.

How you do implement the query is up to you. The handlers are given Current i.e. the Chain itself, and CHAIN_HANDLER is a generic class so you can implement your own protocol.

Direct parents

conformant parents

COMMAND

Summary

exported features

Details

add (c: CHAIN_HANDLER[CHAIN_OF_RESPONSIBILITY])

Add a handler to the Chain.

remove (c: CHAIN_HANDLER[CHAIN_OF_RESPONSIBILITY])

Remove a handler from the Chain.

require

  • has(c)

has (c: CHAIN_HANDLER[CHAIN_OF_RESPONSIBILITY]): BOOLEAN

Does the handler belong to the chain?

execute

Find a suitable handler to handle a request.

Class invariant