zoukankan      html  css  js  c++  java
  • 2013-Proxy代理的使用

    package itour.cn.fare.gateway;

    import java.lang.reflect.InvocationHandler;
    import java.lang.reflect.Method;
    import java.lang.reflect.Proxy;
    import java.util.HashMap;
    import java.util.Map;

    public class ObeQueryProxy implements InvocationHandler{
        private Object target;
        
        public Object bind(Object target) {
            this.target = target;
            //取得代理对象
            return Proxy.newProxyInstance(target.getClass().getClassLoader(),
                    target.getClass().getInterfaces(), this);  
        }

        @Override
        /**
         * 调用方法
         */
        public Object invoke(Object proxy, Method method, Object[] args)
                throws Throwable {
        
                result=method.invoke(target, args);

            }
            return result;
        }


    }

  • 相关阅读:
    SQLAlchemy介绍
    Flask介绍
    逆转的生殖——形而下的EOE补完仪式…
    huiyin
    实验课上
    我的博客今天1岁213天了,我领取了…
    关于直接写屏
    OceanBorn  歌曲列表
    Gethsemane
    光辉岁月-Beyond
  • 原文地址:https://www.cnblogs.com/kuyuyingzi/p/4266316.html
Copyright © 2011-2022 走看看