标签:rgs code ring system 静态 bsp ati oid pac
代理模式:这个为静态代理模式
package com.aff.inter; public class TestProxy { public static void main(String[] args) { Object obj = new ProxyObject(); obj.action(); } } interface Object{ void action(); } //代理类 class ProxyObject implements Object{ Object obj; public ProxyObject(){//构造器 System.out.println("代理类创建成功"); obj = new ObjImpl(); } @Override public void action() { System.out.println("代理类开始执行"); obj.action(); } } //被代理类 class ObjImpl implements Object{ @Override public void action() { System.out.println("====被代理类开始执行===="); System.out.println("====具体的操作===="); System.out.println("====被代理类执行完毕===="); } }
标签:rgs code ring system 静态 bsp ati oid pac
原文地址:https://www.cnblogs.com/afangfang/p/12575833.html