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


Java ProxyFactory.setOpaque方法代码示例

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


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

示例1: getProxyForService

import org.springframework.aop.framework.ProxyFactory; //导入方法依赖的package包/类
/**
 * Get a proxy for the given service object, implementing the specified
 * service interface.
 * <p>Used to export a proxy that does not expose any internals but just
 * a specific interface intended for remote access. Furthermore, a
 * {@link RemoteInvocationTraceInterceptor} will be registered (by default).
 * @return the proxy
 * @see #setServiceInterface
 * @see #setRegisterTraceInterceptor
 * @see RemoteInvocationTraceInterceptor
 */
protected Object getProxyForService() {
	checkService();
	checkServiceInterface();
	ProxyFactory proxyFactory = new ProxyFactory();
	proxyFactory.addInterface(getServiceInterface());
	if (this.registerTraceInterceptor != null ?
			this.registerTraceInterceptor.booleanValue() : this.interceptors == null) {
		proxyFactory.addAdvice(new RemoteInvocationTraceInterceptor(getExporterName()));
	}
	if (this.interceptors != null) {
		AdvisorAdapterRegistry adapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();
		for (int i = 0; i < this.interceptors.length; i++) {
			proxyFactory.addAdvisor(adapterRegistry.wrap(this.interceptors[i]));
		}
	}
	proxyFactory.setTarget(getService());
	proxyFactory.setOpaque(true);
	return proxyFactory.getProxy(getBeanClassLoader());
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:31,代码来源:RemoteExporter.java

示例2: createProxy

import org.springframework.aop.framework.ProxyFactory; //导入方法依赖的package包/类
public static Object createProxy(Class<?>[] classes, Object target, final ClassLoader classLoader,
		BundleContext bundleContext, Advice[] advices) {
	final ProxyFactory factory = new ProxyFactory();

	ClassUtils.configureFactoryForClass(factory, classes);

	for (int i = 0; i < advices.length; i++) {
		factory.addAdvice(advices[i]);
	}

	if (target != null)
		factory.setTarget(target);

	// no need to add optimize since it means implicit usage of CGLib always
	// which is determined automatically anyway
	// factory.setOptimize(true);
	factory.setFrozen(true);
	factory.setOpaque(true);
	boolean isSecurityOn = (System.getSecurityManager() != null);
	try {
		if (isSecurityOn) {
			return AccessController.doPrivileged(new PrivilegedAction<Object>() {
				public Object run() {
					return factory.getProxy(classLoader);
				}
			});
		} else {
			return factory.getProxy(classLoader);
		}

	} catch (NoClassDefFoundError ncdfe) {
		DebugUtils.debugClassLoadingThrowable(ncdfe, bundleContext.getBundle(), classes);
		throw ncdfe;
	}
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:36,代码来源:ProxyUtils.java


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