source: osm/applications/editors/josm/plugins/opendata/includes/org/opengis/util/Cloneable.java@ 28000

Last change on this file since 28000 was 28000, checked in by donvip, 12 years ago

Import new "opendata" JOSM plugin

File size: 2.2 KB
Line 
1/*
2 * GeoTools - The Open Source Java GIS Toolkit
3 * http://geotools.org
4 *
5 * (C) 2011, Open Source Geospatial Foundation (OSGeo)
6 * (C) 2003-2005, Open Geospatial Consortium Inc.
7 *
8 * All Rights Reserved. http://www.opengis.org/legal/
9 */
10package org.opengis.util;
11
12
13/**
14 * Indicates that it is legal to make a field-for-field copy of instances of implementing classes.
15 * A cloneable class implements the J2SE's {@link java.lang.Cloneable} standard interface and
16 * additionnaly overrides the {@link Object#clone()} method with public access.
17 * <p>
18 * Because the {@link Object#clone()} method has protected access, containers wanting to clone
19 * theirs elements need to 1) use Java reflection (which is less efficient than standard method
20 * calls), or 2) cast every elements to a specific type like {@link java.util.Date} (which may
21 * require a large amount of "{@code if (x instanceof y)}" checks if arbitrary classes are
22 * allowed). This {@code Cloneable} interface had a third alternative: checks only for this
23 * interface instead of a list of particular cases.
24 * <p>
25 * Implementors of cloneable classes may consider implementing this interface, but this is not
26 * mandatory. A large amount of independant classes like {@link java.util.Date} will continue to
27 * ignore this interface, so no rule can be enforced anyway. However this interface may help the
28 * work of containers in some case. For example a container may checks for this interface first,
29 * and uses Java reflection as a fallback.
30 *
31 * @author Martin Desruisseaux (IRD)
32 * @since GeoAPI 1.0
33 *
34 * @see java.lang.Cloneable
35 * @see <A HREF="http://developer.java.sun.com/developer/bugParade/bugs/4098033.html">&quot;<cite>Cloneable
36 * doesn't define <code>clone()</code></cite>&quot; on Sun's bug parade</A>
37 *
38 * @source $URL: http://svn.osgeo.org/geotools/branches/2.7.x/modules/library/opengis/src/main/java/org/opengis/util/Cloneable.java $
39 */
40public interface Cloneable extends java.lang.Cloneable {
41 /**
42 * Creates and returns a copy of this object.
43 * The precise meaning of "copy" may depend on the class of the object.
44 *
45 * @return A copy of this object.
46 *
47 * @see Object#clone
48 */
49 Object clone();
50}
Note: See TracBrowser for help on using the repository browser.