View Javadoc
1 /* 2 QueryJ 3 4 Copyright (C) 2002 Jose San Leandro Armend?riz 5 jsanleandro@yahoo.es 6 chousz@yahoo.com 7 8 This library is free software; you can redistribute it and/or 9 modify it under the terms of the GNU General Public 10 License as published by the Free Software Foundation; either 11 version 2.1 of the License, or (at your option) any later version. 12 13 This library is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 General Public License for more details. 17 18 You should have received a copy of the GNU General Public 19 License along with this library; if not, write to the Free Software 20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 22 Thanks to ACM S.L. for distributing this library under the GPL license. 23 Contact info: jsanleandro@yahoo.es 24 Postal Address: c/Playa de Lagoa, 1 25 Urb. Valdecaba?as 26 Boadilla del monte 27 28660 Madrid 28 Spain 29 30 ****************************************************************************** 31 * 32 * Filename: $RCSfile: CardtypesFactory.java,v $ 33 * 34 * Author: Jose San Leandro Armend?riz 35 * 36 * Description: Has the responsiblity of creating in-memory copies of 37 * Cardtypes table rows. Such copies follow the Inmutable 38 * pattern, so they can only be modified using the persistence 39 * layer and resynchronizing. 40 * 41 * Last modified by: $Author: chous $ at $Date: 2003/08/29 08:15:01 $ 42 * 43 * File version: $Revision: 1.1 $ 44 * 45 * Project version: $Name: $ 46 * 47 * $Id: CardtypesFactory.java,v 1.1 2003/08/29 08:15:01 chous Exp $ 48 * 49 */ 50 package org.acmsl.queryj.rdb.oracle; 51 52 /* 53 * Importing ACM-SL classes. 54 */ 55 import org.acmsl.queryj.Field; 56 import org.acmsl.queryj.Table; 57 import org.acmsl.queryj.TableAlias; 58 59 /* 60 * Importing some JDK classes. 61 */ 62 import java.lang.ref.WeakReference; 63 64 /*** 65 * Has the responsiblity of creating in-memory copies of Cardtypes table rows. 66 * Such copies follow the Inmutable pattern, so they can only be modified 67 * using the persistence layer and resynchronizing. 68 * @author <a href="mailto:jsanleandro@yahoo.es">Jose San Leandro</a> 69 * @version $Revision: 1.1 $ 70 */ 71 public class CardtypesFactory 72 { 73 /*** 74 * Singleton implemented as a weak reference. 75 */ 76 private static WeakReference singleton; 77 78 /*** 79 * Protected constructor to avoid accidental instantiation. 80 */ 81 protected CardtypesFactory() {}; 82 83 /*** 84 * Specifies a new weak reference. 85 * @param factory the factory instance to use. 86 */ 87 protected static void setReference(CardtypesFactory factory) 88 { 89 singleton = new WeakReference(factory); 90 } 91 92 /*** 93 * Retrieves the weak reference. 94 * @return such reference. 95 */ 96 protected static WeakReference getReference() 97 { 98 return singleton; 99 } 100 101 /*** 102 * Retrieves a CardtypesFactory instance. 103 * @return such instance. 104 */ 105 public static CardtypesFactory getInstance() 106 { 107 CardtypesFactory result = null; 108 109 WeakReference reference = getReference(); 110 111 if (reference != null) 112 { 113 result = (CardtypesFactory) reference.get(); 114 } 115 116 if (result == null) 117 { 118 result = new CardtypesFactory() {}; 119 120 setReference(result); 121 } 122 123 return result; 124 } 125 126 /*** 127 * Creates a Cardtypes value object from given information. 128 * @param typeid the typeid. 129 * @param typetexty the typetext. 130 */ 131 public CardtypesValueObject createCardtypes( 132 long typeid, 133 String typetext) 134 { 135 CardtypesValueObject result = null; 136 137 if (typetext != null) 138 { 139 result = new CardtypesValueObject(typeid, typetext) {}; 140 } 141 142 return result; 143 } 144 }

This page was automatically generated by Maven