The list of methods to do Object Clone are organized into topic(s).
E
clone(E object) clone
Class<?> c = object.getClass();
try {
return (E) c.getMethod("clone").invoke(object);
} catch (Exception e) {
return null;
Object
clone(Object a) clone
if (a instanceof double[]) {
return ((double[]) a).clone();
if (a instanceof float[]) {
return ((float[]) a).clone();
if (a instanceof long[]) {
return ((long[]) a).clone();
...
Object
clone(Object original) Returns a clone of the given original Object
if (!(original instanceof Cloneable))
throw new CloneNotSupportedException();
try {
return original.getClass().getMethod("clone").invoke(original);
} catch (Exception e) {
throw new CloneNotSupportedException();
Object
clone(Object value) clone
Object rval = null;
if (value instanceof Cloneable) {
try {
rval = value.getClass().getMethod("clone").invoke(value);
} catch (final Exception e) {
rval = e;
if (rval == null || rval instanceof Exception) {
if (value == null || value instanceof String || value instanceof Number || value instanceof Boolean) {
rval = value;
} else {
throw new RuntimeException(new CloneNotSupportedException(
(rval instanceof Exception ? ((Exception) rval).getMessage() : "")));
return rval;
String
clone(String name, String type, int pos) clone
StringBuffer fieldName = new StringBuffer();
toIdentifier(name, fieldName);
String javaFieldName = getFieldName(pos, name, 0);
if (type.startsWith("custom:")) {
String javaType = type.substring(7);
return "rec." + javaFieldName + " = ((" + javaType + ")" + javaFieldName + ".clone());";
} else {
return "rec." + javaFieldName + " = " + javaFieldName;
...
T
clone(T array) Clones the given array object.
Class<?> arrayType = array.getClass();
if (!arrayType.isArray()) {
throw new IllegalArgumentException("specified object is not an array");
Class<?> componentType = arrayType.getComponentType();
Object ret;
if (!componentType.isPrimitive()) {
ret = ((Object[]) array).clone();
...
Object
clone_obj_array(Object source) clonobarray
if (source instanceof float[]) {
return ((float[]) source).clone();
} else {
if (source instanceof short[]) {
return ((short[]) source).clone();
} else {
if (source instanceof byte[]) {
return ((byte[]) source).clone();
...
Class>
cloneClass(Class> clazz) clone Class
Class<?> newClazz = null;
try {
newClazz = Class.forName(clazz.getName());
} catch (ClassNotFoundException e) {
e.printStackTrace();
return newClazz;
T
cloneCloneNotSupportedObject(final T obj, final boolean deep) clone Clone Not Supported Object
if (obj instanceof String) {
return obj;
} else if (obj instanceof Byte) {
return (T) new Byte((Byte) obj);
} else if (obj instanceof Short) {
return (T) new Short((Short) obj);
} else if (obj instanceof Integer) {
return (T) new Integer((Integer) obj);
...
Short
cloneShort(Short sOriginal) Echtes Klonen von Short.
if (sOriginal == null) {
return null;
} else {
return new Short(sOriginal.shortValue());