code: public static void definePrepareMethod(ClassFile cf,
                                             Class storableClass,
                                             TypeDesc supportCtorType,
                                             String supportFieldName,
                                             TypeDesc supportFieldType)
      {
          TypeDesc storableType = TypeDesc.forClass(storableClass);
  
          if (!isPublicMethodFinal(storableClass, PREPARE_METHOD_NAME, storableType, null)) {
              MethodInfo mi = cf.addMethod
                  (Modifiers.PUBLIC, PREPARE_METHOD_NAME, cf.getType(), null);
  
              CodeBuilder b = new CodeBuilder(mi);
              b.newObject(cf.getType());
              b.dup();
              b.loadThis();
              b.loadField(supportFieldName, supportFieldType);
              if (supportFieldType != supportCtorType) {
                  b.checkCast(supportCtorType);
              }
              b.invokeConstructor(new TypeDesc[] {supportCtorType});
              b.returnValue(cf.getType());
          }
  
          definePrepareBridges(cf, storableClass);
      }
docs: Defines a Storable prepare method, which assumes that a support field
  exists and a single-argument constructor exists which accepts a support
  instance.
  
  @param cf file to which to add the prepare method
  @since 1.2