use of net.sf.cglib.transform.impl.UndeclaredThrowableStrategy in project spring-loaded by spring-projects.
the class ProxyBuilder method createProxyFor.
static <T> T createProxyFor(Class<T> clazz, MethodInterceptor mi) {
Enhancer enhancer = new Enhancer();
// if (classLoader != null) {
// enhancer.setClassLoader(classLoader);
// if (classLoader instanceof SmartClassLoader &&
// ((SmartClassLoader) classLoader).isClassReloadable(proxySuperClass)) {
// enhancer.setUseCache(false);
// }
// }
enhancer.setSuperclass(clazz);
enhancer.setStrategy(new UndeclaredThrowableStrategy(UndeclaredThrowableException.class));
//AopProxyUtils.completeProxiedInterfaces(this.advised));
enhancer.setInterfaces(null);
enhancer.setInterceptDuringConstruction(false);
//getCallbacks(rootClass);
Callback[] callbacks = new Callback[] { mi };
enhancer.setCallbacks(callbacks);
// enhancer.setCallbackFilter(new ProxyCallbackFilter(
// this.advised.getConfigurationOnlyCopy(), this.fixedInterceptorMap, this.fixedInterceptorOffset));
Class<?>[] types = new Class[callbacks.length];
for (int x = 0; x < types.length; x++) {
types[x] = callbacks[x].getClass();
}
enhancer.setCallbackTypes(types);
// Generate the proxy class and create a proxy instance.
// Object proxy;
// if (this.constructorArgs != null) {
// proxy = enhancer.create(this.constructorArgTypes, this.constructorArgs);
// }
// else {
@SuppressWarnings("unchecked") T proxy = (T) enhancer.create();
// }
return proxy;
}
use of net.sf.cglib.transform.impl.UndeclaredThrowableStrategy in project spring-loaded by spring-projects.
the class ProxyBuilder method createProxyFor.
static <T> T createProxyFor(Class<T> clazz, MethodInterceptor mi) {
Enhancer enhancer = new Enhancer();
// if (classLoader != null) {
// enhancer.setClassLoader(classLoader);
// if (classLoader instanceof SmartClassLoader &&
// ((SmartClassLoader) classLoader).isClassReloadable(proxySuperClass)) {
// enhancer.setUseCache(false);
// }
// }
enhancer.setSuperclass(clazz);
enhancer.setStrategy(new UndeclaredThrowableStrategy(UndeclaredThrowableException.class));
//AopProxyUtils.completeProxiedInterfaces(this.advised));
enhancer.setInterfaces(null);
enhancer.setInterceptDuringConstruction(false);
//getCallbacks(rootClass);
Callback[] callbacks = new Callback[] { mi };
enhancer.setCallbacks(callbacks);
// enhancer.setCallbackFilter(new ProxyCallbackFilter(
// this.advised.getConfigurationOnlyCopy(), this.fixedInterceptorMap, this.fixedInterceptorOffset));
Class<?>[] types = new Class[callbacks.length];
for (int x = 0; x < types.length; x++) {
types[x] = callbacks[x].getClass();
}
enhancer.setCallbackTypes(types);
// Generate the proxy class and create a proxy instance.
// Object proxy;
// if (this.constructorArgs != null) {
// proxy = enhancer.create(this.constructorArgTypes, this.constructorArgs);
// }
// else {
@SuppressWarnings("unchecked") T proxy = (T) enhancer.create();
// }
return proxy;
}
Aggregations