|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.perfectjpattern.core.behavioral.chainofresponsibility.AbstractHandler<R>
R - Request parameter typepublic abstract class AbstractHandler<R>
Abstract reusable implementation of IHandler interface.
The Default Strategy is OnlyOneHandleStrategy same as
in GoF.
IHandler,
NullHandler![]() |
![]() |
| Constructor Summary | |
|---|---|
AbstractHandler()
Constructs a AbstractHandler from a NullHandler |
|
AbstractHandler(IHandler<R> aSuccessor)
Constructs a AbstractHandler from a Successor |
|
| Method Summary | |
|---|---|
boolean |
canHandle(R aRequest)
Returns true if this IHandler can handle the given request,
false otherwise. |
IHandler<R> |
getSuccessor()
Returns the Successor handler. |
void |
handle(R aRequest)
Handle the given request. |
void |
setChainStrategy(IChainStrategy aStrategy)
Set the IChainStrategy to this IHandler. |
void |
setSuccessor(IHandler<R> aSuccessor)
Sets the Successor element. |
void |
start(R aRequest)
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 class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractHandler()
public AbstractHandler(IHandler<R> aSuccessor)
throws IllegalArgumentException
aSuccessor - Successor handler.
IllegalArgumentException - 'aSuccessor' must not be null.| Method Detail |
|---|
public final void start(R aRequest)
throws IllegalArgumentException
IHandler instance.
start in interface IHandler<R>aRequest - Context-specific request to handle.
IllegalArgumentException - 'aRequest' must not be null.public final IHandler<R> getSuccessor()
getSuccessor in interface IHandler<R>
public boolean canHandle(R aRequest)
throws IllegalArgumentException
IHandler can handle the given request,
false otherwise.
canHandle in interface IHandler<R>aRequest - Context-specific request to handle.
IHandler can handle the given request,
false otherwise.
IllegalArgumentException - 'aRequest' must not be null.
public void handle(R aRequest)
throws IllegalArgumentException
handle in interface IHandler<R>aRequest - Context-specific request to handle.
IllegalArgumentException - 'aRequest' must not be null.
public final void setSuccessor(IHandler<R> aSuccessor)
throws IllegalArgumentException
setSuccessor in interface IHandler<R>aSuccessor - Successor handler
IllegalArgumentException - 'aSuccessor' must not be null.
public final void setChainStrategy(IChainStrategy aStrategy)
throws IllegalArgumentException
IChainStrategy to this IHandler.
IChainStrategy allows to easily modify how the
Chain should behave. Possible implementations are e.g.
setChainStrategy in interface IHandler<R>aStrategy - Continuation strategy defines how the chain should
behave
IllegalArgumentException - 'aStrategy' must not be null.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||