Demo–静态代理模式
- Person接口
1 | public interface Person { |
- Actor类(实现 Person 接口)
1 | public class Actor implements Person{ |
- Agent类(代理Actor类)
1 | public class Agent implements Person{ |
- Test 测试
1 |
|
- 测试结果
1 | Before Actor,Agent say: before |
1 | public interface Person { |
1 | public class Actor implements Person{ |
1 | public class Agent implements Person{ |
1 |
|
1 | Before Actor,Agent say: before |