POF Nested Objects - using registerIdentity
894896Apr 25 2012 — edited May 1 2012Was wondering if anyone has used this? Using the customer example in the 3.7.1 developer guide, the Product class has a nested object called Customer. I might have several Products with the same Customer. So I would want each Product to reference the same Customer object. But not sure if this would work with register identity.
it's also stated that there is some overhead with Coherence keeping track of these POF objects, does anyone know how much overhead?
++(from developer guide)++
++public void serialize(PofWriter pofWriter, Object o) throws IOException++
++{++
++Customer customer = (Customer) o;++
++pofWriter.writeString(0, customer.getName());++
++pofWriter.writeObject(1, customer.getProduct());++
++pofWriter.writeRemainder(null);++
++}++
++@Override++
++public Object deserialize(PofReader pofReader) throws IOException++
++{++
++String sName = pofReader.readString(0);++
++Customer customer = new Customer(sName);++
++pofReader.registerIdentity(customer);++
++customer.setProduct((Product) pofReader.readObject(1));++
++pofReader.readRemainder();++
++return customer;++
++}++