设计模式
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
@ -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("权限校验");
|
||||
|
Reference in New Issue
Block a user