public interface Cloneable extends Cloneable
Cloneablestandard interface and additionally overrides the
Object.clone()method with public access.
Object.clone() method has protected access, containers wanting to clone
theirs elements need to 1) use Java reflection (which is less efficient than standard method
calls), or 2) cast every elements to a specific type like
Date (which may
require a large amount of "
if (x instanceof y)" checks if arbitrary classes are
Cloneable interface had a third alternative: checks only for this
interface instead of a list of particular cases.
Implementors of cloneable classes may consider implementing this interface, but this is not
mandatory. A large amount of independent classes like
Date will continue to
ignore this interface, so no rule can be enforced anyway. However this interface may help the
work of containers in some case. For example a container may checks for this interface first,
and uses Java reflection as a fallback.
Cloneable, "Cloneable doesn't define
clone()" on Sun's bug parade
Defined in the
Copyright © 2009–2017 Geotoolkit.org. All rights reserved.