Skip to content

Commit db174f1

Browse files
committed
设计模式
1 parent 0aeefd7 commit db174f1

File tree

12 files changed

+863
-5
lines changed

12 files changed

+863
-5
lines changed

code/Java/design-pattern/src/main/java/com/heibaiying/creational/prototype/SmartPhone.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public void call() {
2222
@Override
2323
protected Object clone() throws CloneNotSupportedException {
2424
SmartPhone smartPhone = (SmartPhone) super.clone();
25+
// 对引用对象进行拷贝
2526
smartPhone.productionDate = (Date) smartPhone.productionDate.clone();
2627
return smartPhone;
2728
}

code/Java/design-pattern/src/main/java/com/heibaiying/structural/proxy/cglib/Proxy.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ public Object getProxyInstance() {
2626
return enhancer.create();
2727
}
2828

29+
/**
30+
* 我们只需要实现此处的拦截逻辑,其他代码都是相对固定的
31+
*/
2932
@Override
3033
public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws InvocationTargetException, IllegalAccessException {
3134
System.out.println("权限校验");

0 commit comments

Comments
 (0)