List of utility methods to do Object Clone
StackTraceElement[] | cloneStackTrace(Throwable aException) clone Stack Trace StackTraceElement[] stack = aException.getStackTrace(); StackTraceElement[] newStack = new StackTraceElement[stack.length]; for (int i = 0; i < newStack.length; i++) { StackTraceElement element = stack[i]; newStack[i] = new StackTraceElement(element.getClassName(), element.getMethodName(), element.getFileName(), element.getLineNumber()); return newStack; ... |
Object | copyIfNecessary(final Object val) copy If Necessary if (val instanceof Map) { return deepCopy((Map<String, ?>) val); } else if (val instanceof List) { return deepCopy((List<?>) val); } else { return val; |