
com.magictools.core.clone.DefaultCloneable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of magic-tools-all Show documentation
Show all versions of magic-tools-all Show documentation
magic-tools 是一个小而全的Java工具类库,通过静态方法封装,降低相关API的学习成本,提高工作效率,使Java拥有函数式语言般的优雅,让Java语言也可以“甜甜的”。
The newest version!
package com.magictools.core.clone;
import com.magictools.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 - 2025 Weber Informatics LLC | Privacy Policy