|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.perfectjpattern.core.api.behavioral.chainofresponsibility.NullHandler
public final class NullHandler
Null Object Pattern implementation of IHandler
.
NullHandler
is a Singleton therefore it may not be directly
instantiated, neither it may be extended.
Method Summary | |
---|---|
boolean |
canHandle(Object aRequest)
Returns true if this IHandler can handle the given request,
false otherwise. |
static NullHandler |
getInstance()
Returns Singleton instance of NullHandler . |
IHandler<Object> |
getSuccessor()
Returns the Successor handler. |
void |
handle(Object aRequest)
Handle the given request. |
void |
setChainStrategy(IChainStrategy aStrategy)
Set the IChainStrategy to this IHandler . |
void |
setSuccessor(IHandler<Object> aSuccessor)
Sets the Successor element. |
void |
start(Object 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 |
Method Detail |
---|
public static NullHandler getInstance()
NullHandler
.
NullHandler
.public IHandler<Object> getSuccessor() throws UnsupportedOperationException
getSuccessor
in interface IHandler<Object>
UnsupportedOperationException
public void start(Object aRequest) throws IllegalArgumentException
IHandler
instance.
start
in interface IHandler<Object>
aRequest
- Context-specific request to handle.
IllegalArgumentException
- 'aRequest' must not be null.public boolean canHandle(Object aRequest) throws IllegalArgumentException
IHandler
can handle the given request,
false otherwise.
canHandle
in interface IHandler<Object>
aRequest
- Context-specific request to handle.
IHandler
can handle the given request,
false otherwise.
IllegalArgumentException
- 'aRequest' must not be null.public void handle(Object aRequest)
handle
in interface IHandler<Object>
aRequest
- Context-specific request to handle.public void setSuccessor(IHandler<Object> aSuccessor) throws UnsupportedOperationException
setSuccessor
in interface IHandler<Object>
aSuccessor
- Successor handler
UnsupportedOperationException
public 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<Object>
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 |