Top Description Constructors Methods
org.jdom2

pack-priv Class CloneBase

extends Object
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Known Direct Subclasses
org.jdom2.Content, org.jdom2.Document, org.jdom2.Attribute

This simple class just tidies up any cloneable classes. This method deals with any CloneNotSupported exceptions. THis class is package private only.
Author
Rolf Lear

Constructor Summary

AccessConstructor and Description
protected
CloneBase()

Change the permission of the no-arg constructor from public to protected.

Method Summary

Modifier and TypeMethod and Description
protected CloneBase
clone()

Overrides java.lang.Object.clone.

Return a deep clone of this instance.
Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

CloneBaseback to summary
protected CloneBase()

Change the permission of the no-arg constructor from public to protected.

Otherwise package-private class's constructor is not really public. Changing this to 'protected' makes this constructor available to all subclasses regardless of the subclass's package. This in turn makes it possible to make all th subclasses of this CloneBase class serializable.

Method Detail

cloneback to summary
protected CloneBase clone()

Overrides java.lang.Object.clone.

Return a deep clone of this instance. Even if this instance has a parent, the returned clone will not.

All JDOM core classes are Cloneable, and never throw CloneNotSupportedException. Additionally all Cloneable JDOM classes return the correct type of instance from this method and there is no need to cast the result (co-variant return value).

Subclasses of this should still call super.clone() in their clone method.

Returns:CloneBase

Doc from java.lang.Object.clone.

a clone of this instance.

Annotations
@Override