| This interface should be implemented by classes wishing to
support of override Object.clone() . The default
behaviour of clone() performs a shallow copy, but
subclasses often change this to perform a deep copy. Therefore,
it is a good idea to document how deep your clone will go.
If clone() is called on an object which does not
implement this interface, a CloneNotSupportedException
will be thrown.
This interface is simply a tagging interface; it carries no
requirements on methods to implement. However, it is typical for
a Cloneable class to implement at least equals ,
hashCode , and clone , sometimes
increasing the accessibility of clone to be public. The typical
implementation of clone invokes super.clone()
rather than a constructor, but this is not a requirement.
If an object that implement Cloneable should not be cloned,
simply override the clone method to throw a
CloneNotSupportedException .
All array types implement Cloneable, and have a public
clone method that will never fail with a
CloneNotSupportedException .
author: Paul Fisher author: Eric Blake author: Warren Levy See Also: Object.clone See Also: CloneNotSupportedException since: 1.0 |