Evaluating Software Design Patterns
— the "Gang of Four" patterns implemented in Java 6

dk.rode.thesis.chainofresponsibility
Interface HandlerLink<R>

Type Parameters:
R - The request type handled by connected handlers.
All Known Subinterfaces:
HandlerChain<R>
All Known Implementing Classes:
AbstractHandlerChain, StandardHandlerChain, WeakHandlerChain

public interface HandlerLink<R>

A handler link represents a connection to the next handler in a given handler chain.

A link is invoked from the previous handler that could not handle a request, forwarding the both the request and the (unsuccessful) handler itself.

A handler chain will normally be represented as a HandlerChain object, but this is not a requirement.

Author:
Gunni Rode / rode.dk

Method Summary
 Handler<R> forward(R request, Handler<R> current)
          Forwards the the request supplied as request to the handler represented by this link.
 

Method Detail

forward

Handler<R> forward(R request,
                   Handler<R> current)
Forwards the the request supplied as request to the handler represented by this link.

The next handler is the handler after current in the chain. current can be located at any place in the chain, and if not found, all handlers in the chain are tried.

Parameters:
request - The request to handle; nullability determined by the actual handler implementation.
current - The handler in the chain that could not handle request; can be null if this link represents the first handler in the chain.
Returns:
The handler that handled request, if any. Can be null.

Gunni Rode / rode.dk

Feel free to use and/or modify the Java 6 source code developed for this thesis AT YOUR OWN RISK, but note that the source code comes WITHOUT ANY — and I do mean WITHOUT ANY — form of warranty WHAT SO EVER!

The original thesis and source code are available at rode.dk/thesis.