/** * Calls the Clone method on the given object of some type that extends * CloneableSerializable. * * Note: It assumes that the given object's clone method will return the * same object of type T. * * @param <T> The type of the object to clone. * @param object The object to clone. * @return The clone. */ @SuppressWarnings("unchecked") public static <T extends CloneableSerializable> T cloneSafe( T object) { if ( object == null ) { return null; } else { return (T) object.clone(); } }
/** * Calls the Clone method on the given object of some type that extends * CloneableSerializable. * * Note: It assumes that the given object's clone method will return the * same object of type T. * * @param <T> The type of the object to clone. * @param object The object to clone. * @return The clone. */ @SuppressWarnings("unchecked") public static <T extends CloneableSerializable> T cloneSafe( T object) { if ( object == null ) { return null; } else { return (T) object.clone(); } }
/** * Calls the Clone method on the given object of some type that extends * CloneableSerializable. * * Note: It assumes that the given object's clone method will return the * same object of type T. * * @param <T> The type of the object to clone. * @param object The object to clone. * @return The clone. */ @SuppressWarnings("unchecked") public static <T extends CloneableSerializable> T cloneSafe( T object) { if ( object == null ) { return null; } else { return (T) object.clone(); } }