protected void writeStoreObject(Property prop, Class propType, IndentedWriter iw)
     throws IOException {
   IndirectPolicy policy = indirectingPolicy(prop, propType);
   if (policy == IndirectPolicy.DEFINITELY_INDIRECT) writeIndirectStoreObject(prop, propType, iw);
   else if (policy == IndirectPolicy.INDIRECT_ON_EXCEPTION) {
     iw.println("try");
     iw.println("{");
     iw.upIndent();
     iw.println("//test serialize");
     iw.println("SerializableUtils.toByteArray(" + prop.getName() + ");");
     super.writeStoreObject(prop, propType, iw);
     iw.downIndent();
     iw.println("}");
     iw.println("catch (NotSerializableException nse)");
     iw.println("{");
     iw.upIndent();
     writeIndirectStoreObject(prop, propType, iw);
     iw.downIndent();
     iw.println("}");
   } else if (policy == IndirectPolicy.DEFINITELY_DIRECT)
     super.writeStoreObject(prop, propType, iw);
   else
     throw new InternalError("indirectingPolicy() overridden to return unknown policy: " + policy);
 }
 protected void writeUnstoreObject(Property prop, Class propType, IndentedWriter iw)
     throws IOException {
   IndirectPolicy policy = indirectingPolicy(prop, propType);
   if (policy == IndirectPolicy.DEFINITELY_INDIRECT
       || policy == IndirectPolicy.INDIRECT_ON_EXCEPTION) {
     iw.println(
         "// we create an artificial scope so that we can use the name o for all indirectly serialized objects.");
     iw.println("{");
     iw.upIndent();
     iw.println("Object o = ois.readObject();");
     iw.println(
         "if (o instanceof IndirectlySerialized) o = ((IndirectlySerialized) o).getObject();");
     iw.println("this." + prop.getName() + " = (" + prop.getSimpleTypeName() + ") o;");
     iw.downIndent();
     iw.println("}");
   } else if (policy == IndirectPolicy.DEFINITELY_DIRECT)
     super.writeUnstoreObject(prop, propType, iw);
   else
     throw new InternalError("indirectingPolicy() overridden to return unknown policy: " + policy);
 }
 public void generate(
     ClassInfo info, Class superclassType, Property[] props, Class[] propTypes, IndentedWriter iw)
     throws IOException {
   super.generate(info, superclassType, props, propTypes, iw);
   writeExtraDeclarations(info, superclassType, props, propTypes, iw);
 }