All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.hutool.core.clone.DefaultCloneable Maven / Gradle / Ivy

There is a newer version: 5.8.33
Show newest version
package cn.hutool.core.clone;


import cn.hutool.core.util.ReflectUtil;

/**
 * 克隆默认实现接口,用于实现返回指定泛型类型的克隆方法
 *
 * @param  泛型类型
 * @since 5.7.17
 */
public interface DefaultCloneable extends java.lang.Cloneable {

	/**
	 * 浅拷贝,提供默认的泛型返回值的clone方法。
	 *
	 * @return obj
	 */
	default T clone0() {
		try {
			return ReflectUtil.invoke(this, "clone");
		} catch (Exception e) {
			throw new CloneRuntimeException(e);
		}
	}
}






© 2015 - 2024 Weber Informatics LLC | Privacy Policy