clone ( object object ) : object
Clone an object (copy by value).
Object to clone must be cloneable and contains just cloneable objets. If you create your own class, add a clone method and use a structure like that :
class MyClass implements Cloneable
{
def prop1
def prop2
public Object clone()
{
MyClass o = new MyClass()
o.prop1 = prop1.clone()
o.prop2 = prop2.clone()
return o
}
}
or again:
class MyClass implements Cloneable
{
public Object clone()
{
Object o = null
try {
o = super.clone();
} catch(CloneNotSupportedException cnse) {
console("Clone error: "+cnse)
}
return o;
}
}
Parameters
object
Cloneable object