1 //---------------------------------------------------------------------- 2 // 3 // PerfectJPattern: "Design patterns are good but components are better!" 4 // AbstractParameterlessHandler.java Copyright (c) 2009 Giovanni Azua Garcia 5 // bravegag@hotmail.com 6 // 7 // This program is free software; you can redistribute it and/or 8 // modify it under the terms of the GNU General Public License 9 // as published by the Free Software Foundation; either version 3 10 // of the License, or (at your option) any later version. 11 // 12 // This program is distributed in the hope that it will be useful, 13 // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 // GNU General Public License for more details. 16 // 17 // You should have received a copy of the GNU General Public License 18 // along with this program; if not, see <http://www.gnu.org/licenses/>. 19 // 20 //---------------------------------------------------------------------- 21 package org.perfectjpattern.core.behavioral.chainofresponsibility; 22 23 import org.perfectjpattern.core.api.behavioral.chainofresponsibility.*; 24 25 /** 26 * Abstract reusable implementation of <code>IParameterlessHandler</code> 27 * interface. 28 * <br/> 29 * 30 * @see IParameterlessHandler 31 * @see NullRequest 32 * 33 * @author <a href="mailto:bravegag@hotmail.com">Giovanni Azua</a> 34 * @version $Revision: 1.0 $ $Date: Nov 6, 2007 6:15:59 PM $ 35 */ 36 public abstract 37 class AbstractParameterlessHandler 38 extends AbstractHandler<NullRequest> 39 implements IParameterlessHandler 40 { 41 //------------------------------------------------------------------------ 42 // public 43 //------------------------------------------------------------------------ 44 /** 45 * Constructs new instance of AbstractParameterlessHandler 46 */ 47 public 48 AbstractParameterlessHandler() 49 { 50 super(); 51 } 52 53 //------------------------------------------------------------------------ 54 /** 55 * Constructs new instance of AbstractParameterlessHandler specifying the 56 * Successor Element. 57 * 58 * @param aSuccessor The Successor Element. 59 */ 60 public 61 AbstractParameterlessHandler(IParameterlessHandler aSuccessor) 62 { 63 super(aSuccessor); 64 } 65 66 //------------------------------------------------------------------------ 67 /** 68 * {@inheritDoc} 69 */ 70 public final void 71 start() 72 { 73 super.start(NullRequest.getInstance()); 74 } 75 76 //------------------------------------------------------------------------ 77 /** 78 * {@inheritDoc} 79 */ 80 @Override 81 public boolean 82 canHandle(NullRequest aRequest) 83 throws IllegalArgumentException 84 { 85 return true; 86 } 87 88 //------------------------------------------------------------------------ 89 /** 90 * {@inheritDoc} 91 */ 92 @Override 93 public final void 94 handle(NullRequest aRequest) 95 throws IllegalArgumentException 96 { 97 handle(); 98 } 99 }