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


Java ProxyFactory.setFrozen方法代码示例

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


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

示例1: createProxy

import org.springframework.aop.framework.ProxyFactory; //导入方法依赖的package包/类
private Object createProxy(final Class<?> clazz, Advice cardinalityInterceptor) {
	ProxyFactory factory = new ProxyFactory();
	factory.setProxyTargetClass(true);
	factory.setOptimize(true);
	factory.setTargetClass(clazz);

	factory.addAdvice(cardinalityInterceptor);
	factory.setFrozen(true);

	return factory.getProxy(ProxyFactory.class.getClassLoader());
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:12,代码来源:ServiceProxyTst.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

示例3: createProxy

import org.springframework.aop.framework.ProxyFactory; //导入方法依赖的package包/类
/**
 * Create an AOP proxy for the given bean.
 * @param beanClass the class of the bean
 * @param beanName the name of the bean
 * @param specificInterceptors the set of interceptors that is
 * specific to this bean (may be empty, but not null)
 * @param targetSource the TargetSource for the proxy,
 * already pre-configured to access the bean
 * @return the AOP proxy for the bean
 * @see #buildAdvisors
 */
protected Object createProxy(
		Class<?> beanClass, String beanName, Object[] specificInterceptors, TargetSource targetSource) {

	ProxyFactory proxyFactory = new ProxyFactory();
	// Copy our properties (proxyTargetClass etc) inherited from ProxyConfig.
	proxyFactory.copyFrom(this);

	if (!proxyFactory.isProxyTargetClass()) {
		if (shouldProxyTargetClass(beanClass, beanName)) {
			proxyFactory.setProxyTargetClass(true);
		}
		else {
			evaluateProxyInterfaces(beanClass, proxyFactory);
		}
	}

	Advisor[] advisors = buildAdvisors(beanName, specificInterceptors);
	for (Advisor advisor : advisors) {
		proxyFactory.addAdvisor(advisor);
	}

	proxyFactory.setTargetSource(targetSource);
	customizeProxyFactory(proxyFactory);

	proxyFactory.setFrozen(this.freezeProxy);
	if (advisorsPreFiltered()) {
		proxyFactory.setPreFiltered(true);
	}

	return proxyFactory.getProxy(this.proxyClassLoader);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:43,代码来源:AbstractAutoProxyCreator.java

示例4: createProxy

import org.springframework.aop.framework.ProxyFactory; //导入方法依赖的package包/类
/**
 * Create an AOP proxy for the given bean.
 * @param beanClass the class of the bean
 * @param beanName the name of the bean
 * @param specificInterceptors the set of interceptors that is
 * specific to this bean (may be empty, but not null)
 * @param targetSource the TargetSource for the proxy,
 * already pre-configured to access the bean
 * @return the AOP proxy for the bean
 * @see #buildAdvisors
 */
protected Object createProxy(
		Class<?> beanClass, String beanName, Object[] specificInterceptors, TargetSource targetSource) {

	if (this.beanFactory instanceof ConfigurableListableBeanFactory) {
		AutoProxyUtils.exposeTargetClass((ConfigurableListableBeanFactory) this.beanFactory, beanName, beanClass);
	}

	ProxyFactory proxyFactory = new ProxyFactory();
	proxyFactory.copyFrom(this);

	if (!proxyFactory.isProxyTargetClass()) {
		if (shouldProxyTargetClass(beanClass, beanName)) {
			proxyFactory.setProxyTargetClass(true);
		}
		else {
			evaluateProxyInterfaces(beanClass, proxyFactory);
		}
	}

	Advisor[] advisors = buildAdvisors(beanName, specificInterceptors);
	for (Advisor advisor : advisors) {
		proxyFactory.addAdvisor(advisor);
	}

	proxyFactory.setTargetSource(targetSource);
	customizeProxyFactory(proxyFactory);

	proxyFactory.setFrozen(this.freezeProxy);
	if (advisorsPreFiltered()) {
		proxyFactory.setPreFiltered(true);
	}

	return proxyFactory.getProxy(getProxyClassLoader());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:46,代码来源:AbstractAutoProxyCreator.java

示例5: wrapHandler

import org.springframework.aop.framework.ProxyFactory; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private <T> T wrapHandler(final Class<T> interfaceClass, final T handler) {
  ProxyFactory proxyFactory =
      new ProxyFactory(interfaceClass, new SingletonTargetSource(handler));
  niftyConfigurer.configureProxyFactory(proxyFactory);
  // TODO remove from here?
  proxyFactory.setFrozen(true);
  return (T) proxyFactory.getProxy();
}
 
开发者ID:bigdullrock,项目名称:nifty-spring-boot-starter,代码行数:10,代码来源:NiftyServerRunner.java


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