1 /** 2 * Copyright (C) 2004 France Telecom R&D 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 */ 18 package org.objectweb.medor.clone.api; 19 20 /** 21 * Defines a Cloneable object. The simple way to launch the cloning of an object 22 * graph is to call 'myObj.clone(null, new HashMap())'. 23 * 24 * @author S.Chassande-Barrioz 25 */ 26 public interface Cloneable extends java.lang.Cloneable { 27 28 /** 29 * Clone the current object. 30 * @param clone is the clone of the current object or the null value. The 31 * interest of this parameter is to permit to an implementation to specify 32 * its instance and in particular to chose how the instance is created 33 * (which constructor). If this parameter is not null, it must be an 34 * instance of the current object. 35 * @param obj2clone is the context of the cloning. It contains the 36 * association between an object and its clone. When an object is cloned, 37 * it should be registered with its clone into the map. By this way object 38 * graph could be cloned without having two different clones for the same 39 * source object 40 * @return a clone instance of the current object. If the clone parameter is 41 * not null, the returned object is the parameter. Otherwise the 42 * implementation of the method must instanciate a clone in order to never 43 * retrieve a null value. 44 * 45 * @throws CloneNotSupportedException if an error occurs during the cloning 46 * step. 47 */ 48 Object clone(Object clone, java.util.Map obj2clone) throws CloneNotSupportedException; 49 } 50