static <T> T createProxy(Class<T> cls, ClassLoader loader, InvocationHandler handler) { return cls.cast(ProxyHelper.getProxy(loader == null ? cls.getClassLoader() : loader, new Class[]{Client.class, InvocationHandlerAware.class, cls}, handler)); }
static <T> T createProxy(Class<T> cls, ClassLoader loader, InvocationHandler handler) { return cls.cast(ProxyHelper.getProxy(loader == null ? cls.getClassLoader() : loader, new Class[]{Client.class, cls}, handler)); }
static <T> T createProxy(Class<T> cls, ClassLoader loader, InvocationHandler handler) { return cls.cast(ProxyHelper.getProxy(loader == null ? cls.getClassLoader() : loader, new Class[]{Client.class, InvocationHandlerAware.class, cls}, handler)); }
private Book createCglibProxy(final Book book) { final InvocationHandler handler = new InvocationHandler() { public Object invoke(Object object, Method method, Object[] args) throws Throwable { return method.invoke(book, args); } }; return (Book)ProxyHelper.getProxy(this.getClass().getClassLoader(), new Class[]{Book.class}, handler); }
private static Object createEscapeHandler(Class<?> cls, String simpleClassName) { try { String postFix = getPostfix(cls); if (postFix == null) { LOG.log(Level.WARNING, "Failed to create" + simpleClassName + " for unknown jaxb class:" + cls); return null; } Class<?> handlerClass = ClassLoaderUtils.loadClass("com.sun.xml" + postFix + ".bind.marshaller." + simpleClassName, cls); Class<?> handlerInterface = ClassLoaderUtils .loadClass("com.sun.xml" + postFix + ".bind.marshaller.CharacterEscapeHandler", cls); Object targetHandler = ReflectionUtil.getDeclaredField(handlerClass, "theInstance").get(null); return ProxyHelper.getProxy(cls.getClassLoader(), new Class[] {handlerInterface}, new EscapeHandlerInvocationHandler(targetHandler)); } catch (Exception e) { if ("NoEscapeHandler".equals(simpleClassName)) { //this class doesn't exist in JAXB 2.2 so expected LOG.log(Level.FINER, "Failed to create " + simpleClassName); } else { LOG.log(Level.INFO, "Failed to create " + simpleClassName); } } return null; }
private static Object createEscapeHandler(Class<?> cls, String simpleClassName) { try { String postFix = getPostfix(cls); if (postFix == null) { LOG.log(Level.WARNING, "Failed to create" + simpleClassName + " for unknown jaxb class:" + cls); return null; } Class<?> handlerClass = ClassLoaderUtils.loadClass("com.sun.xml" + postFix + ".bind.marshaller." + simpleClassName, cls); Class<?> handlerInterface = ClassLoaderUtils .loadClass("com.sun.xml" + postFix + ".bind.marshaller.CharacterEscapeHandler", cls); Object targetHandler = ReflectionUtil.getDeclaredField(handlerClass, "theInstance").get(null); return ProxyHelper.getProxy(cls.getClassLoader(), new Class[] {handlerInterface}, new EscapeHandlerInvocationHandler(targetHandler)); } catch (Exception e) { if ("NoEscapeHandler".equals(simpleClassName)) { //this class doesn't exist in JAXB 2.2 so expected LOG.log(Level.FINER, "Failed to create " + simpleClassName); } else { LOG.log(Level.INFO, "Failed to create " + simpleClassName); } } return null; }
proxyLoader == null ? serviceClassFinal.getClassLoader() : proxyLoader); Class<?>[] ifaces = new Class<?>[]{Client.class, InvocationHandlerAware.class, cri.getServiceClass()}; Client actualClient = (Client)ProxyHelper.getProxy(theLoader, ifaces, proxyImpl); proxyImpl.setProxyClient(actualClient); notifyLifecycleManager(actualClient);
proxyLoader == null ? serviceClassFinal.getClassLoader() : proxyLoader); Class<?>[] ifaces = new Class<?>[]{Client.class, InvocationHandlerAware.class, cri.getServiceClass()}; Client actualClient = (Client)ProxyHelper.getProxy(theLoader, ifaces, proxyImpl); proxyImpl.setProxyClient(actualClient); notifyLifecycleManager(actualClient);
Client actualClient = (Client)ProxyHelper.getProxy(theLoader, ifaces, proxyImpl);
Object obj = ProxyHelper.getProxy(getClassLoader(clientFactoryBean.getServiceClass()), classes, handler);
Object obj = ProxyHelper.getProxy(getClassLoader(clientFactoryBean.getServiceClass()), classes, handler);