本文整理汇总了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());
}
示例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;
}
}
示例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);
}
示例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());
}
示例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();
}