From c9cd906881e9800768dd6eda9cd484ee9c985b4f Mon Sep 17 00:00:00 2001
From: Valery Yatsynovich
* The purpose of the deep cloner is to create a deep clone of an object. An
@@ -45,7 +46,7 @@
public class DeepCloner implements DeepClonerSPI {
private final ClassLoader targetCL;
- private final Map
* The purpose of the deep cloner is to create a deep clone of an object. An
@@ -27,39 +28,40 @@
public class DeepCloner implements DeepClonerSPI {
private final XStream xStream;
- /**
- * Clone using the supplied ClassLoader.
- * @param classLoader - the classloader to loaded cloned classes.
- */
- public DeepCloner(ClassLoader classLoader) {
+ /**
+ * Clone using the supplied ClassLoader.
+ * @param classLoader - the classloader to loaded cloned classes.
+ */
+ public DeepCloner(ClassLoader classLoader) {
xStream = new XStream();
- disableSecurity();
- xStream.omitField(SingleClassloaderExecutor.class, "classloader");
+ disableSecurity();
+ xStream.omitField(SingleClassloaderExecutor.class, "classloader");
xStream.setClassLoader(classLoader);
- }
+ }
- private void disableSecurity() {
- XStream.setupDefaultSecurity(xStream);
- xStream.allowTypesByRegExp(new String[]{".*"});
- }
+ private void disableSecurity() {
+ XStream.setupDefaultSecurity(xStream);
+ xStream.allowTypesByRegExp(new String[]{".*"});
+ }
- /**
- * Clone using the current ContextClassLoader.
- */
- public DeepCloner() {
- this(Thread.currentThread().getContextClassLoader());
- }
+ /**
+ * Clone using the current ContextClassLoader.
+ */
+ public DeepCloner() {
+ this(Thread.currentThread().getContextClassLoader());
+ }
- /**
- * Clones an object.
- *
+ /**
+ * Clones an object.
+ *
* @param objectToClone the object to clone.
- * @return A deep clone of the object to clone.
- */
- @SuppressWarnings("unchecked")
- public