DoubleArrayParameterMapperTest.java 文件源码

java
阅读 53 收藏 0 点赞 0 评论 0

项目:uroborosql 作者:
private static <I> I newProxy(final Class<I> interfaceType) {
    Object o = new Object();

    Method getOriginal;
    try {
        getOriginal = ProxyContainer.class.getMethod("getOriginal");
    } catch (NoSuchMethodException | SecurityException e) {
        throw new AssertionError(e);
    }

    I proxyInstance = newProxy(interfaceType, new Class<?>[] { ProxyContainer.class }, (proxy, method, args) -> {
        if (getOriginal.equals(method)) {
            return o;
        }

        for (int i = 0; i < args.length; i++) {
            if (args[i] instanceof ProxyContainer) {
                args[i] = ((ProxyContainer) args[i]).getOriginal();
            }
        }
        return method.invoke(o, args);
    });
    return proxyInstance;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号