File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ public class HelloSeriviceImpl implements HelloSerivice{
1212 }
1313}
1414```
15- 上面的代码比较简单,定义了一个接口和其实现类。这就是代理模式中的目标对象和目标对象的接口。接下类定义代理对象 。
15+ 上面的代码比较简单,定义了一个接口和其实现类。这就是代理模式中的目标对象和目标对象的接口。接下来定义代理对象 。
1616```
1717public class HelloSeriviceProxy implements HelloSerivice{
1818
@@ -50,9 +50,10 @@ public class Main {
5050
5151这就是一个简单的静态的代理模式的实现。代理模式中的所有角色(代理对象、目标对象、目标对象的接口)等都是在编译期就确定好的。
5252
53- 静态代理的用途
54- 控制真实对象的访问权限 通过代理对象控制对真实对象的使用权限。
53+ 静态代理的用途
5554
56- 避免创建大对象 通过使用一个代理小对象来代表一个真实的大对象,可以减少系统资源的消耗,对系统进行优化并提高运行速度 。
55+ 1.控制真实对象的访问权限:通过代理对象控制真实对象的使用权限 。
5756
58- 增强真实对象的功能 这个比较简单,通过代理可以在调用真实对象的方法的前后增加额外功能。
57+ 2.避免创建大对象:通过使用一个代理小对象来代表一个真实的大对象,可以减少系统资源的消耗,对系统进行优化并提高运行速度。
58+
59+ 3.增强真实对象的功能:这个比较简单,通过代理可以在调用真实对象的方法的前后增加额外功能。
You can’t perform that action at this time.
0 commit comments