private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();

    isAdapter = in.readBoolean();
    if (isAdapter) {
      if (adapter_readAdapterObject == null) throw new ClassNotFoundException();
      Object[] args = {this, in};
      try {
        javaObject = adapter_readAdapterObject.invoke(null, args);
      } catch (Exception ex) {
        throw new IOException();
      }
    } else {
      javaObject = in.readObject();
    }

    String className = (String) in.readObject();
    if (className != null) {
      staticType = Class.forName(className);
    } else {
      staticType = null;
    }

    initMembers();
  }
 public NativeJavaObject(
     Scriptable scope, Object javaObject, Class<?> staticType, boolean isAdapter) {
   this.parent = scope;
   this.javaObject = javaObject;
   this.staticType = staticType;
   this.isAdapter = isAdapter;
   initMembers();
 }