@SuppressWarnings("unchecked")
  public static <T extends Serializable> T deepClone(T serializable, ClassLoader classLoader) {
    """
	Clone by serializing / deserializing... only works if the object is actually serializable!
    """
    if(serializable == null)
      return null;

    try
    {
      return (T) IOUtils.deserialize(IOUtils.serialize(serializable), classLoader);
    }
    catch(IOException e)
    {
      throw new InternalException(e);
    }
    catch(ClassNotFoundException e)
    {
      throw new InternalException(e);
    }
  }
@SuppressWarnings("unchecked")
  public static <T extends Serializable> T deepClone(T serializable, ClassLoader classLoader)
  {
    if(serializable == null)
      return null;

    try
    {
      return (T) IOUtils.deserialize(IOUtils.serialize(serializable), classLoader);
    }
    catch(IOException e)
    {
      throw new InternalException(e);
    }
    catch(ClassNotFoundException e)
    {
      throw new InternalException(e);
    }
  }
@ SuppressWarnings ( "unchecked" ) public static < T extends Serializable > T deepClone ( T serializable , ClassLoader classLoader ) { if ( serializable == null ) return null ; try { return ( T ) IOUtils . deserialize ( IOUtils . serialize ( serializable ) , classLoader ) ; } catch ( IOException e ) { throw new InternalException ( e ) ; } catch ( ClassNotFoundException e ) { throw new InternalException ( e ) ; } }
Clone by serializing / deserializing... only works if the object is actually serializable!
Clone by serializing / deserializing ... only works if the object is actually serializable!