1 //---------------------------------------------------------------------- 2 // 3 // PerfectJPattern: "Design patterns are good but components are better!" 4 // NullParameter.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.api.behavioral.command; 22 23 import org.perfectjpattern.core.api.creational.singleton.ISingleton; 24 25 /** 26 * Null Object Pattern implementation of Command <code>Parameter</code>. 27 * Prevents different <code>Command</code> implementations from pushing 28 * <code>null</code> into the <code>Receiver</code>'s 29 * <code>execute</code> method. 30 * <br/><br/> 31 * <code>NullParameter</code> is a Singleton therefore it can not be directly 32 * instantiated, neither it may be extended. 33 * <br/><br/> 34 * 35 * @author <a href="mailto:bravegag@hotmail.com">Giovanni Azua</a> 36 * @version $Revision: 1.0 $ $Date: Jun 19, 2007 10:17:38 PM $ 37 */ 38 public final 39 class NullParameter 40 implements ISingleton 41 { 42 //------------------------------------------------------------------------ 43 // public 44 //------------------------------------------------------------------------ 45 /** 46 * Returns Singleton instance of <code>NullParameter</code>. 47 * 48 * @return Singleton instance of <code>NullParameter</code>. 49 */ 50 public static NullParameter 51 getInstance() 52 { 53 return INSTANCE; 54 } 55 56 //------------------------------------------------------------------------ 57 // private 58 //------------------------------------------------------------------------ 59 private 60 NullParameter() 61 { 62 // do nothing 63 } 64 65 //------------------------------------------------------------------------ 66 // members 67 //------------------------------------------------------------------------ 68 /** 69 * Singleton instance of <code>NullParameter</code> 70 */ 71 private static final NullParameter INSTANCE = new NullParameter(); 72 }