/** java.io.ObjectStreamClass#forClass() */ public void test_forClass() { // Need to test during serialization to be sure an instance is // returned ObjectStreamClass osc = ObjectStreamClass.lookup(DummyClass.class); assertEquals( "forClass returned an object: " + osc.forClass(), DummyClass.class, osc.forClass()); }
protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException { Class cl = desc.forClass(); if (ProxyFactory.isProxyClass(cl)) { writeBoolean(true); Class superClass = cl.getSuperclass(); Class[] interfaces = cl.getInterfaces(); byte[] signature = ProxyFactory.getFilterSignature(cl); String name = superClass.getName(); writeObject(name); // we don't write the marker interface ProxyObject writeInt(interfaces.length - 1); for (int i = 0; i < interfaces.length; i++) { Class interfaze = interfaces[i]; if (interfaze != ProxyObject.class && interfaze != Proxy.class) { name = interfaces[i].getName(); writeObject(name); } } writeInt(signature.length); write(signature); } else { writeBoolean(false); super.writeClassDescriptor(desc); } }
/** {@inheritDoc} */ @Override protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException { writeClass(desc.forClass()); }
/** {@inheritDoc} */ @Override protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { return desc.forClass(); }