java.lang

Interface Cloneable

Known Subinterfaces:
AclEntry, Attribute, AttributedCharacterIterator, Attributes, CertPathBuilderResult, CertPathParameters, CertPathValidatorResult, CertSelector, CertStoreParameters, CharacterIterator, CRLSelector, Descriptor, GSSCredential, Name
Known Implementing Classes:
AbstractAction, ActivationDataFlavor, AffineTransform, Arc2D, Arc2D.Double, Arc2D.Float, Area, AreaAveragingScaleFilter, ArrayDeque<E>, ArrayList<E>, AttributeList, Attributes, BasicAttribute, BasicAttributes, BasicDesktopPaneUI.CloseAction, BasicDesktopPaneUI.MaximizeAction, BasicDesktopPaneUI.MinimizeAction, BasicDesktopPaneUI.NavigateAction, BasicDesktopPaneUI.OpenAction, BasicFileChooserUI.ApproveSelectionAction, BasicFileChooserUI.CancelSelectionAction, BasicFileChooserUI.ChangeToParentDirectoryAction, BasicFileChooserUI.GoHomeAction, BasicFileChooserUI.NewFolderAction, BasicFileChooserUI.UpdateAction, BasicInternalFrameTitlePane.CloseAction, BasicInternalFrameTitlePane.IconifyAction, BasicInternalFrameTitlePane.MaximizeAction, BasicInternalFrameTitlePane.MoveAction, BasicInternalFrameTitlePane.RestoreAction, BasicInternalFrameTitlePane.SizeAction, BasicSliderUI.ActionScroller, BasicTextUI.BasicCaret, BasicTreeUI.TreeCancelEditingAction, BasicTreeUI.TreeHomeAction, BasicTreeUI.TreeIncrementAction, BasicTreeUI.TreePageAction, BasicTreeUI.TreeToggleAction, BasicTreeUI.TreeTraverseAction, BitSet, BreakIterator, BufferCapabilities, BufferedImageFilter, Calendar, ChoiceFormat, Chromaticity, Collator, CollectionCertStoreParameters, ColorSupported, CompositeName, CompoundName, Compression, ConcurrentSkipListMap<K,V>, ConcurrentSkipListSet<E>, Copies, CopiesSupported, CopyOnWriteArrayList<E>, CropImageFilter, CubicCurve2D, CubicCurve2D.Double, CubicCurve2D.Float, DataFlavor, Date, Date, DateFormat, DateFormatSymbols, DateFormatter, DateTimeAtCompleted, DateTimeAtCreation, DateTimeAtProcessing, DateTimeSyntax, DecimalFormat, DecimalFormatSymbols, DefaultCaret, DefaultEditorKit, DefaultEditorKit.BeepAction, DefaultEditorKit.CopyAction, DefaultEditorKit.CutAction, DefaultEditorKit.DefaultKeyTypedAction, DefaultEditorKit.InsertBreakAction, DefaultEditorKit.InsertContentAction, DefaultEditorKit.InsertTabAction, DefaultEditorKit.PasteAction, DefaultFormatter, DefaultListSelectionModel, DefaultMutableTreeNode, DefaultTreeSelectionModel, Destination, Dimension, Dimension2D, DimensionUIResource, DocFlavor, DocFlavor.BYTE_ARRAY, DocFlavor.CHAR_ARRAY, DocFlavor.INPUT_STREAM, DocFlavor.READER, DocFlavor.SERVICE_FORMATTED, DocFlavor.STRING, DocFlavor.URL, DocumentName, EditorKit, ElementIterator, Ellipse2D, Ellipse2D.Double, Ellipse2D.Float, EnumMap<K,extends,Enum,K,V>, EnumSet<T,extends,Enum,T>, EnumSyntax, Fidelity, Finishings, Format, GeneralPath, GlyphVector, GlyphView, GrayFilter, GregorianCalendar, GridBagConstraints, HashMap<K,V>, HashSet<T>, Hashtable<K,V>, HTMLEditorKit, HTMLEditorKit.HTMLTextAction, HTMLEditorKit.InsertHTMLTextAction, IdentityHashMap<K,V>, ImageCapabilities, ImageFilter, InlineView, Insets, InsetsUIResource, IntegerSyntax, InternationalFormatter, JarEntry, JobAttributes, JobHoldUntil, JobImpressions, JobImpressionsCompleted, JobImpressionsSupported, JobKOctets, JobKOctetsProcessed, JobKOctetsSupported, JobMediaSheets, JobMediaSheetsCompleted, JobMediaSheetsSupported, JobMessageFromOperator, JobName, JobOriginatingUserName, JobPriority, JobPrioritySupported, JobSheets, JobState, JobStateReason, JobStateReasons, JTree.DynamicUtilTreeNode, JTree.EmptySelectionModel, Kernel, LabelView, LDAPCertStoreParameters, Line2D, Line2D.Double, Line2D.Float, LinkedHashMap<K,V>, LinkedHashSet<T>, LinkedList<T>, LinkRef, Locale, Mac, Manifest, MaskFormatter, MBeanAttributeInfo, MBeanConstructorInfo, MBeanInfo, MBeanNotificationInfo, MBeanOperationInfo, MBeanParameterInfo, Media, MediaName, MediaSize, MediaSizeName, MediaTray, MessageFormat, MetalFileChooserUI.DirectoryComboBoxAction, MetaMessage, MidiMessage, MultipleDocumentHandling, NumberFormat, NumberFormatter, NumberOfDocuments, NumberOfInterveningJobs, NumberUp, NumberUpSupported, OpenMBeanAttributeInfoSupport, OpenMBeanConstructorInfoSupport, OpenMBeanInfoSupport, OpenMBeanOperationInfoSupport, OpenMBeanParameterInfoSupport, OrientationRequested, OutputDeviceAssigned, PageAttributes, PageFormat, PageRanges, PagesPerMinute, PagesPerMinuteColor, Paper, ParameterBlock, PDLOverrideSupported, PKIXBuilderParameters, PKIXCertPathBuilderResult, PKIXCertPathChecker, PKIXCertPathValidatorResult, PKIXParameters, Point, Point2D, Point2D.Double, Point2D.Float, PresentationDirection, PrinterInfo, PrinterIsAcceptingJobs, PrinterLocation, PrinterMakeAndModel, PrinterMessageFromOperator, PrinterMoreInfo, PrinterMoreInfoManufacturer, PrinterName, PrinterResolution, PrinterState, PrinterStateReason, PrinterStateReasons, PrinterURI, PrintQuality, Properties, Provider, QuadCurve2D, QuadCurve2D.Double, QuadCurve2D.Float, QueuedJobCount, Rectangle, Rectangle2D, Rectangle2D.Double, Rectangle2D.Float, RectangularShape, Reference, ReferenceUriSchemesSupported, RenderContext, RenderingHints, ReplicateScaleFilter, RequestingUserName, ResolutionSyntax, RGBImageFilter, RoundRectangle2D, RoundRectangle2D.Double, RoundRectangle2D.Float, RTFEditorKit, RuleBasedCollator, Segment, SetOfIntegerSyntax, Severity, SheetCollate, ShortMessage, Sides, SimpleAttributeSet, SimpleDateFormat, SimpleTimeZone, Size2DSyntax, Stack<T>, StringCharacterIterator, StyledEditorKit, StyledEditorKit.AlignmentAction, StyledEditorKit.BoldAction, StyledEditorKit.FontFamilyAction, StyledEditorKit.FontSizeAction, StyledEditorKit.ForegroundAction, StyledEditorKit.ItalicAction, StyledEditorKit.StyledTextAction, StyledEditorKit.UnderlineAction, SysexMessage, TabularDataSupport, TextAction, TextLayout, TextMeasurer, TextSyntax, Time, Timestamp, TimeZone, TreeMap<K,V>, TreeSet<T>, UIDefaults, URISyntax, Vector<T>, X509CertSelector, X509CRLSelector, XMLGregorianCalendar, ZipEntry

public interface Cloneable

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.

Since:
1.0
See Also:
Object.clone(), CloneNotSupportedException

Cloneable.java -- Interface for marking objects cloneable by Object.clone() Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.