|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IParameterlessHandler
Chain of Responsibility Design Pattern: 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. (Gamma et al, Design Patterns)
Responsibility: Abstract definition of the "Handler".
//
// Create chain elements
//
IParameterlessHandler myFirst = new ConcreteHandler();
IParameterlessHandler mySecond = new ConcreteHandler();
IParameterlessHandler myThird = new ConcreteHandler();
//
// Associate Handler elements
//
myFirst.setSuccessor(mySecond);
mySecond.setSuccessor(myThird);
//
// Execute the first Handler that triggers the execution of the
// complete chain.
//
myFirst.start();
Method Summary | |
---|---|
void |
handle()
Handle the given request. |
void |
start()
Triggers execution of the Chain if the target Handler is the first reference, otherwise implements the decision-making regarding forwarding the request to its successor IHandler instance. |
Methods inherited from interface org.perfectjpattern.core.api.behavioral.chainofresponsibility.IHandler |
---|
canHandle, getSuccessor, handle, setChainStrategy, setSuccessor, start |
Method Detail |
---|
void start()
IHandler
instance.
void handle()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |