All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----Acme.GenericCloneable
In the current JDK, the API for cloning is slightly broken. The intent was for classes that didn't need to clone any sub-objects to be able to just add an "implements Cloneable" and have everything work. However, as it stands now, such classes still need to implement a clone method.
What's annoying is that all of these no-sub-objects clone methods are completely identical. Every one of them looks like this:
public Object clone()
{
try
{
return super.clone();
}
catch ( CloneNotSupportedException e )
{
// Shouldn't happen.
throw new InternalError( e.toString() );
}
}
Well, what this class does is implement that clone method. If your
class doesn't need to have anything else as parent (true for "struct"
classes), then just make GenericCloneable the parent and presto, you're
cloneable.
Fetch the software.
Fetch the entire Acme package.
public GenericCloneable()
public Object clone()
All Packages Class Hierarchy This Package Previous Next Index
ACME Java ACME Labs