org.perfectjpattern.core.behavioral.chainofresponsibility
Class OnlyOneHandleStrategy

java.lang.Object
  extended by org.perfectjpattern.core.behavioral.chainofresponsibility.OnlyOneHandleStrategy
All Implemented Interfaces:
IChainStrategy, IStrategy

public final class OnlyOneHandleStrategy
extends Object
implements IChainStrategy

Concrete implementation of IChainStrategy that allows only one IHandler to handle the given request then stops the processing of the chain.

OnlyOneHandleStrategy is stateless, reentrant and a Singleton therefore it may not be directly instantiated, neither it may be extended.

Version:
$Revision: 1.0 $ $Date: Nov 8, 2007 9:57:12 PM $
Author:
Giovanni Azua
 

Method Summary
static IChainStrategy getInstance()
          Returns Singleton instance of OnlyOneHandlesStrategy.
 void process(IHandler<Object> aHandler, Object aRequest)
          Defines the decision-logic regarding handling and forwarding of the requests.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static IChainStrategy getInstance()
Returns Singleton instance of OnlyOneHandlesStrategy.

Returns:
Singleton instance of OnlyOneHandlesStrategy.

process

public void process(IHandler<Object> aHandler,
                    Object aRequest)
Defines the decision-logic regarding handling and forwarding of the requests.

Specified by:
process in interface IChainStrategy
Parameters:
aHandler - Chain of Responsibility IHandler instance.
aRequest - Request to process


Copyright © 2007-2009. All Rights Reserved.