Interface Cloneable

All Superinterfaces:
Cloneable
All Known Subinterfaces:
GeneralParameterValue, GridCoordinates, Matrix, ParameterValue<T>, ParameterValueGroup, XMatrix
All Known Implementing Classes:
AbstractParameter, AffineTransform2D, AffineTransform2D, AnchorPointImpl, BasicLineStyle, BasicPolygonStyle, BursaWolfParameters, CheckedArrayList, CheckedHashMap, CheckedHashSet, Complex, DisplacementImpl, Envelope2DArchived, ExtentImpl, ExternalGraphicImpl, FeatureTypeStyleImpl, FillImpl, FloatParameter, FontImpl, GeneralBounds, GeneralGridCoordinates, GeneralGridCoordinates.Immutable, GeneralMatrix, GeneralPosition, GraphicImpl, GridCoordinates2D, GridEnvelope2D, HaloImpl, ImageGeometry, ImagingParameters, IntegerList, Line, LinePlacementImpl, LineSymbolizerImpl, MarkImpl, Matrix1, Matrix2, Matrix3, Matrix4, MatrixParameters, NamedStyleImpl, Parameter, ParameterGroup, PointPlacementImpl, PointSymbolizerImpl, PolygonSymbolizerImpl, Position1D, Position2D, Position3D, RangeSet, RangeSpecifier, RuleImpl, Statistics, Statistics.Delta, StrokeImpl, StyleImpl, TextSymbolizerImpl, TransformedPosition, XPathUtil.Step, XPathUtil.StepList

public interface Cloneable extends Cloneable
Indicates that it is legal to make a field-for-field copy of instances of implementing classes. A cloneable class implements the J2SE's Cloneable standard interface and additionnaly overrides the Object.clone() method with public access.

Because the 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 allowed). This 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 independant 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.

Since:
GeoAPI 1.0
Author:
Martin Desruisseaux (IRD)
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates and returns a copy of this object.
  • Method Details

    • clone

      Object clone()
      Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object.
      Returns:
      A copy of this object.
      See Also: