protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException { boolean isProxy = readBoolean(); if (isProxy) { String name = (String)readObject(); Class superClass = loader.loadClass(name); int length = readInt(); Class[] interfaces = new Class[length]; for (int i = 0; i < length; i++) { name = (String)readObject(); interfaces[i] = loader.loadClass(name); } length = readInt(); byte[] signature = new byte[length]; read(signature); ProxyFactory factory = new ProxyFactory(); // we must always use the cache and never use writeReplace when using // ProxyObjectOutputStream and ProxyObjectInputStream factory.setUseCache(true); factory.setUseWriteReplace(false); factory.setSuperclass(superClass); factory.setInterfaces(interfaces); Class proxyClass = factory.createClass(signature); return ObjectStreamClass.lookup(proxyClass); } else { return super.readClassDescriptor(); } }
@Override protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException { boolean isProxy = readBoolean(); if (isProxy) { String name = (String)readObject(); Class<?> superClass = loader.loadClass(name); int length = readInt(); Class<?>[] interfaces = new Class[length]; for (int i = 0; i < length; i++) { name = (String)readObject(); interfaces[i] = loader.loadClass(name); } length = readInt(); byte[] signature = new byte[length]; read(signature); ProxyFactory factory = new ProxyFactory(); // we must always use the cache and never use writeReplace when using // ProxyObjectOutputStream and ProxyObjectInputStream factory.setUseCache(true); factory.setUseWriteReplace(false); factory.setSuperclass(superClass); factory.setInterfaces(interfaces); Class<?> proxyClass = factory.createClass(signature); return ObjectStreamClass.lookup(proxyClass); } return super.readClassDescriptor(); }
private static PyObjectValueProxyClass getProxyClass(PyObject pyObject) throws Exception { String proxyClassName = pyObject.getClass() + PROXY_CLASS_SUFFIX; PyObjectValueProxyClass proxyClass = proxyClasses.get(proxyClassName); if (proxyClass == null) { writeLock.lock(); try { proxyClass = proxyClasses.get(proxyClassName); if (proxyClass == null) { ProxyFactory factory = new ProxyFactory(); factory.setSuperclass(pyObject.getClass()); factory.setInterfaces(new Class[]{PyObjectValue.class}); factory.setFilter(new PyObjectValueMethodFilter()); factory.setUseWriteReplace(false); proxyClasses.putIfAbsent(proxyClassName, createProxyClass(factory.createClass(), pyObject)); proxyClass = proxyClasses.get(proxyClassName); } } finally { writeLock.unlock(); } } return proxyClass; }
private static PyObjectValueProxyClass getProxyClass(PyObject pyObject) throws Exception { String proxyClassName = pyObject.getClass() + PROXY_CLASS_SUFFIX; PyObjectValueProxyClass proxyClass = proxyClasses.get(proxyClassName); if (proxyClass == null) { writeLock.lock(); try { proxyClass = proxyClasses.get(proxyClassName); if (proxyClass == null) { ProxyFactory factory = new ProxyFactory(); factory.setSuperclass(pyObject.getClass()); factory.setInterfaces(new Class[]{PyObjectValue.class}); factory.setFilter(new PyObjectValueMethodFilter()); factory.setUseWriteReplace(false); proxyClasses.putIfAbsent(proxyClassName, createProxyClass(factory.createClass(), pyObject)); proxyClass = proxyClasses.get(proxyClassName); } } finally { writeLock.unlock(); } } return proxyClass; }
public static <T> Class<T> createProxyClass(Class<T> proxyClass, boolean forSubclassing) { ProxyFactory proxyFactory = new ProxyFactory(); if (proxyClass != null) { proxyFactory.setSuperclass(proxyClass); proxyFactory.setUseWriteReplace(false); } if (forSubclassing) proxyFactory.setInterfaces(new Class<?>[]{LifecycleMixin.class, TargetInstanceProxy.class}); else proxyFactory.setInterfaces(new Class<?>[]{LifecycleMixin.class, TargetInstanceProxy.class}); Class<T> clazz = proxyFactory.createClass(); return clazz; }
public static <T> Class<T> createProxyClassWithHandler(ClassMetadata<T> proxyClass, MethodHandler methodHandler) { ProxyFactory proxyFactory = new ProxyFactory(); proxyFactory.setUseWriteReplace(false); if (proxyClass != null) { proxyFactory.setSuperclass(proxyClass.getJavaClass()); } proxyFactory.setInterfaces(new Class<?>[]{LifecycleMixin.class, TargetInstanceProxy.class}); proxyFactory.setHandler(methodHandler); Class<T> clazz = proxyFactory.createClass(); return clazz; }
origin = getOriginObject(origin); ProxyFactory factory = new ProxyFactory(); factory.setUseWriteReplace(false); factory.setFilter(FormProxyHandler.FORM_METHOD_FILTER); if (origin instanceof FormProxyObject)
factory.setUseWriteReplace(false); if (origin instanceof List) { return (T) new ListProxy((List) origin, annotations);
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException { boolean isProxy = readBoolean(); if (isProxy) { String name = (String)readObject(); Class superClass = loader.loadClass(name); int length = readInt(); Class[] interfaces = new Class[length]; for (int i = 0; i < length; i++) { name = (String)readObject(); interfaces[i] = loader.loadClass(name); } length = readInt(); byte[] signature = new byte[length]; read(signature); ProxyFactory factory = new ProxyFactory(); // we must always use the cache and never use writeReplace when using // ProxyObjectOutputStream and ProxyObjectInputStream factory.setUseCache(true); factory.setUseWriteReplace(false); factory.setSuperclass(superClass); factory.setInterfaces(interfaces); Class proxyClass = factory.createClass(signature); return ObjectStreamClass.lookup(proxyClass); } else { return super.readClassDescriptor(); } }
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException { boolean isProxy = readBoolean(); if (isProxy) { String name = (String)readObject(); Class superClass = loader.loadClass(name); int length = readInt(); Class[] interfaces = new Class[length]; for (int i = 0; i < length; i++) { name = (String)readObject(); interfaces[i] = loader.loadClass(name); } length = readInt(); byte[] signature = new byte[length]; read(signature); ProxyFactory factory = new ProxyFactory(); // we must always use the cache and never use writeReplace when using // ProxyObjectOutputStream and ProxyObjectInputStream factory.setUseCache(true); factory.setUseWriteReplace(false); factory.setSuperclass(superClass); factory.setInterfaces(interfaces); Class proxyClass = factory.createClass(signature); return ObjectStreamClass.lookup(proxyClass); } else { return super.readClassDescriptor(); } }
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException { boolean isProxy = readBoolean(); if (isProxy) { String name = (String)readObject(); Class superClass = loader.loadClass(name); int length = readInt(); Class[] interfaces = new Class[length]; for (int i = 0; i < length; i++) { name = (String)readObject(); interfaces[i] = loader.loadClass(name); } length = readInt(); byte[] signature = new byte[length]; read(signature); ProxyFactory factory = new ProxyFactory(); // we must always use the cache and never use writeReplace when using // ProxyObjectOutputStream and ProxyObjectInputStream factory.setUseCache(true); factory.setUseWriteReplace(false); factory.setSuperclass(superClass); factory.setInterfaces(interfaces); Class proxyClass = factory.createClass(signature); return ObjectStreamClass.lookup(proxyClass); } else { return super.readClassDescriptor(); } }
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException { boolean isProxy = readBoolean(); if (isProxy) { String name = (String)readObject(); Class superClass = loader.loadClass(name); int length = readInt(); Class[] interfaces = new Class[length]; for (int i = 0; i < length; i++) { name = (String)readObject(); interfaces[i] = loader.loadClass(name); } length = readInt(); byte[] signature = new byte[length]; read(signature); ProxyFactory factory = new ProxyFactory(); // we must always use the cache and never use writeReplace when using // ProxyObjectOutputStream and ProxyObjectInputStream factory.setUseCache(true); factory.setUseWriteReplace(false); factory.setSuperclass(superClass); factory.setInterfaces(interfaces); Class proxyClass = factory.createClass(signature); return ObjectStreamClass.lookup(proxyClass); } else { return super.readClassDescriptor(); } }