org.perfectjpattern.core.behavioral.chainofresponsibility
Class AbstractParameterlessHandler

java.lang.Object
  extended by org.perfectjpattern.core.behavioral.chainofresponsibility.AbstractHandler<NullRequest>
      extended by org.perfectjpattern.core.behavioral.chainofresponsibility.AbstractParameterlessHandler
All Implemented Interfaces:
IHandler<NullRequest>, IParameterlessHandler

public abstract class AbstractParameterlessHandler
extends AbstractHandler<NullRequest>
implements IParameterlessHandler

Abstract reusable implementation of IParameterlessHandler interface.

Version:
$Revision: 1.0 $ $Date: Nov 6, 2007 6:15:59 PM $
Author:
Giovanni Azua
See Also:
IParameterlessHandler, NullRequest
 

Constructor Summary
AbstractParameterlessHandler()
          Constructs new instance of AbstractParameterlessHandler
AbstractParameterlessHandler(IParameterlessHandler aSuccessor)
          Constructs new instance of AbstractParameterlessHandler specifying the Successor Element.
 
Method Summary
 boolean canHandle(NullRequest aRequest)
          Returns true if this IHandler can handle the given request, false otherwise.
 void handle(NullRequest aRequest)
          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 class org.perfectjpattern.core.behavioral.chainofresponsibility.AbstractHandler
getSuccessor, setChainStrategy, setSuccessor, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.perfectjpattern.core.api.behavioral.chainofresponsibility.IParameterlessHandler
handle
 
Methods inherited from interface org.perfectjpattern.core.api.behavioral.chainofresponsibility.IHandler
getSuccessor, setChainStrategy, setSuccessor, start
 

Constructor Detail

AbstractParameterlessHandler

public AbstractParameterlessHandler()
Constructs new instance of AbstractParameterlessHandler


AbstractParameterlessHandler

public AbstractParameterlessHandler(IParameterlessHandler aSuccessor)
Constructs new instance of AbstractParameterlessHandler specifying the Successor Element.

Parameters:
aSuccessor - The Successor Element.
Method Detail

start

public final 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.

Specified by:
start in interface IParameterlessHandler

canHandle

public boolean canHandle(NullRequest aRequest)
                  throws IllegalArgumentException
Returns true if this IHandler can handle the given request, false otherwise.

Specified by:
canHandle in interface IHandler<NullRequest>
Overrides:
canHandle in class AbstractHandler<NullRequest>
Parameters:
aRequest - Context-specific request to handle.
Returns:
true if this IHandler can handle the given request, false otherwise.
Throws:
IllegalArgumentException - 'aRequest' must not be null.

handle

public final void handle(NullRequest aRequest)
                  throws IllegalArgumentException
Handle the given request. Implements the actual handling logic and must not contain any decision-making regarding e.g. forwarding the request.

Specified by:
handle in interface IHandler<NullRequest>
Overrides:
handle in class AbstractHandler<NullRequest>
Parameters:
aRequest - Context-specific request to handle.
Throws:
IllegalArgumentException - 'aRequest' must not be null.


Copyright © 2007-2009. All Rights Reserved.