当前位置: 首页>>代码示例>>Java>>正文


Java ProxyFactoryBean.setTargetClass方法代码示例

本文整理汇总了Java中org.springframework.aop.framework.ProxyFactoryBean.setTargetClass方法的典型用法代码示例。如果您正苦于以下问题:Java ProxyFactoryBean.setTargetClass方法的具体用法?Java ProxyFactoryBean.setTargetClass怎么用?Java ProxyFactoryBean.setTargetClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.aop.framework.ProxyFactoryBean的用法示例。


在下文中一共展示了ProxyFactoryBean.setTargetClass方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: proxyAdvice

import org.springframework.aop.framework.ProxyFactoryBean; //导入方法依赖的package包/类
private static <T> T proxyAdvice(T t, Advice methodInterceptor) {
    ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();
    proxyFactoryBean.setTargetClass(t.getClass());
    proxyFactoryBean.setTarget(t);
    proxyFactoryBean.addAdvice(methodInterceptor);
    return (T) proxyFactoryBean.getObject();
}
 
开发者ID:maniaclee,项目名称:shardy,代码行数:8,代码来源:ShardSqlSessionFactoryBean.java

示例2: proxyAdvice

import org.springframework.aop.framework.ProxyFactoryBean; //导入方法依赖的package包/类
public static <T> T proxyAdvice(T t, Advice methodInterceptor) {
    ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();
    proxyFactoryBean.setTargetClass(t.getClass());
    proxyFactoryBean.setTarget(t);
    proxyFactoryBean.addAdvice(methodInterceptor);
    return (T) proxyFactoryBean.getObject();
}
 
开发者ID:maniaclee,项目名称:shardy,代码行数:8,代码来源:ProxyUtils.java

示例3: buildToStringCapableProxy

import org.springframework.aop.framework.ProxyFactoryBean; //导入方法依赖的package包/类
private <T> T buildToStringCapableProxy(Class<? extends T> tClass, T t) throws ClassNotFoundException {

        MethodInterceptor toString = methodInvocation ->
                (methodInvocation.getMethod().getName().equals("toString")) ?
                        ToStringBuilder.reflectionToString(t, ToStringStyle.MULTI_LINE_STYLE) :
                        methodInvocation.getMethod().invoke(t, methodInvocation.getArguments());

        ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();
        proxyFactoryBean.setTarget(t);
        proxyFactoryBean.setProxyTargetClass(true);
        proxyFactoryBean.addAdvice(toString);
        proxyFactoryBean.setTargetClass(tClass);
        return tClass.cast(proxyFactoryBean.getObject());
    }
 
开发者ID:joshlong,项目名称:selfies,代码行数:15,代码来源:ToStringBeanPostProcessor.java

示例4: proxy

import org.springframework.aop.framework.ProxyFactoryBean; //导入方法依赖的package包/类
private static <T> T proxy(Class<T> tClass,
                           MethodInterceptor methodInterceptor) {
    ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();
    proxyFactoryBean.addAdvice(methodInterceptor);
    proxyFactoryBean.setProxyTargetClass(true);
    proxyFactoryBean.setTargetClass(tClass);
    return tClass.cast(proxyFactoryBean.getObject());
}
 
开发者ID:joshlong,项目名称:sfdc-cloudfoundry,代码行数:9,代码来源:Application.java

示例5: proxy

import org.springframework.aop.framework.ProxyFactoryBean; //导入方法依赖的package包/类
private <T> T proxy(Class<T> tClass, MethodInterceptor methodInterceptor) {
    ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();
    proxyFactoryBean.addAdvice(methodInterceptor);
    proxyFactoryBean.setProxyTargetClass(true);
    proxyFactoryBean.setTargetClass(tClass);
    return tClass.cast(proxyFactoryBean.getObject());
}
 
开发者ID:joshlong,项目名称:sfdc-cloudfoundry,代码行数:8,代码来源:ProcessorConfiguration.java


注:本文中的org.springframework.aop.framework.ProxyFactoryBean.setTargetClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。