设计模式

This commit is contained in:
luoxiang
2019-12-08 19:48:21 +08:00
parent 0aeefd7e05
commit db174f1624
12 changed files with 863 additions and 5 deletions

View File

@ -22,6 +22,7 @@ public class SmartPhone implements Cloneable {
@Override
protected Object clone() throws CloneNotSupportedException {
SmartPhone smartPhone = (SmartPhone) super.clone();
// 对引用对象进行拷贝
smartPhone.productionDate = (Date) smartPhone.productionDate.clone();
return smartPhone;
}

View File

@ -26,6 +26,9 @@ public class Proxy implements MethodInterceptor {
return enhancer.create();
}
/**
* 我们只需要实现此处的拦截逻辑,其他代码都是相对固定的
*/
@Override
public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws InvocationTargetException, IllegalAccessException {
System.out.println("权限校验");