1 |
/* Cloneable.java -- Interface for marking objects cloneable by Object.clone() |
/* Cloneable.java -- Interface for marking objects cloneable by Object.clone() |
2 |
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. |
Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
7 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
8 |
the Free Software Foundation; either version 2, or (at your option) |
the Free Software Foundation; either version 2, or (at your option) |
9 |
any later version. |
any later version. |
10 |
|
|
11 |
GNU Classpath is distributed in the hope that it will be useful, but |
GNU Classpath is distributed in the hope that it will be useful, but |
12 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
38 |
|
|
39 |
package java.lang; |
package java.lang; |
40 |
|
|
|
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 |
|
|
* "The Java Language Specification", ISBN 0-201-63451-1 |
|
|
* plus online API docs for JDK 1.2 beta from http://www.javasoft.com. |
|
|
* Status: Believed complete and correct. |
|
|
*/ |
|
|
|
|
41 |
/** |
/** |
42 |
* This interface should be implemented by classes wishing to |
* This interface should be implemented by classes wishing to |
43 |
* support of override <code>Object.clone()</code>. The default |
* support of override <code>Object.clone()</code>. The default |
47 |
* If <code>clone()</code> is called on an object which does not |
* If <code>clone()</code> is called on an object which does not |
48 |
* implement this interface, a <code>CloneNotSupportedException</code> |
* implement this interface, a <code>CloneNotSupportedException</code> |
49 |
* will be thrown. |
* will be thrown. |
|
* <p> |
|
50 |
* |
* |
51 |
* This interface is simply a tagging interface; it carries no |
* <p>This interface is simply a tagging interface; it carries no |
52 |
* requirements on methods to implement. However, it is typical for |
* requirements on methods to implement. However, it is typical for |
53 |
* a Cloneable class to implement at least <code>equals</code>, |
* a Cloneable class to implement at least <code>equals</code>, |
54 |
* <code>hashCode</code>, and <code>clone</code>, sometimes |
* <code>hashCode</code>, and <code>clone</code>, sometimes |
55 |
* increasing the accessibility of clone to be public. The typical |
* increasing the accessibility of clone to be public. The typical |
56 |
* implementation of <code>clone</code> invokes <code>super.clone()</code> |
* implementation of <code>clone</code> invokes <code>super.clone()</code> |
57 |
* rather than a constructor, but this is not a requirement. |
* rather than a constructor, but this is not a requirement. |
|
* <p> |
|
58 |
* |
* |
59 |
* If an object that implement Cloneable should not be cloned, |
* <p>If an object that implement Cloneable should not be cloned, |
60 |
* simply override the <code>clone</code> method to throw a |
* simply override the <code>clone</code> method to throw a |
61 |
* <code>CloneNotSupportedException</code>. |
* <code>CloneNotSupportedException</code>. |
|
* <p> |
|
62 |
* |
* |
63 |
* All array types implement Cloneable, and have a public |
* <p>All array types implement Cloneable, and have a public |
64 |
* <code>clone</code> method that will never fail with a |
* <code>clone</code> method that will never fail with a |
65 |
* <code>CloneNotSupportedException</code>. |
* <code>CloneNotSupportedException</code>. |
66 |
* |
* |
|
* @since 1.0 |
|
67 |
* @author Paul Fisher |
* @author Paul Fisher |
68 |
* @author Eric Blake <ebb9@email.byu.edu> |
* @author Eric Blake <ebb9@email.byu.edu> |
69 |
* @author Warren Levy <warrenl@cygnus.com> |
* @author Warren Levy <warrenl@cygnus.com> |
|
* |
|
70 |
* @see Object#clone() |
* @see Object#clone() |
71 |
* @see CloneNotSupportedException |
* @see CloneNotSupportedException |
72 |
|
* @since 1.0 |
73 |
|
* @status updated to 1.4 |
74 |
*/ |
*/ |
75 |
public interface Cloneable |
public interface Cloneable |
76 |
{ |
{ |