docs: @Override
      public BSONObject create(boolean array, List<String> pathParts) {
          if (rootClass == null) {
              return array ? new BasicDBList() : new BasicDBObject();
          }
  
          if (pathParts == null) {
              try {
                  return (DBObject) rootClass.newInstance();
              } catch (Exception e) {
                  throw new RuntimeException(e);
              }
          }
  
          String path = buildPath(pathParts);
          Class returnClass;
  
          if ((returnClass = getClassFromCache(path)) == null) {
              returnClass = deriveClass(path, pathParts.get(pathParts.size() - 1), array);
          }
  
          // At this point, we know what class to construct and the class cache is properly set
  
          if (DBObject.class.isAssignableFrom(returnClass)) {
              try {
                  return (DBObject) returnClass.newInstance();
              } catch (Exception e) {
                  throw new RuntimeException(e);
              }
          } else if (Map.class.isAssignableFrom(returnClass)) {
              if (Modifier.isAbstract(returnClass.getModifiers()) || Modifier.isInterface(returnClass.getModifiers())) {
                  return new DirtyableDBObjectMap();
              } else {
                  try {
                      return new DirtyableDBObjectMap((Map) returnClass.newInstance());
                  } catch (Exception e) {
                      throw new RuntimeException(e);
                  }
              }
          } else if (List.class.isAssignableFrom(returnClass)) {
              if (Modifier.isAbstract(returnClass.getModifiers()) || Modifier.isInterface(returnClass.getModifiers())) {
                  return new DirtyableDBObjectList();
              } else {
                  try {
                      return new DirtyableDBObjectList((List) returnClass.newInstance(), false);
                  } catch (Exception e) {
                      throw new RuntimeException(e);
                  }
              }
          } else if (Set.class.isAssignableFrom(returnClass)) {
              DirtyableDBObjectSet dirtyableDBObjectSet;
  
              if (Modifier.isAbstract(returnClass.getModifiers()) || Modifier.isInterface(returnClass.getModifiers())) {
                  dirtyableDBObjectSet = new DirtyableDBObjectSet();
              } else {
                  try {
                      dirtyableDBObjectSet = new DirtyableDBObjectSet((Set) returnClass.newInstance(), false);
                  } catch (Exception e) {
                      throw new RuntimeException(e);
                  }
              }
  
              // The MongoDB Java Driver adds objects to the container before populating them.  To maintain
              // set semantics (which may require using the objects' values), we run a decoding hook to
              // properly configure the set.
              BSON.addDecodingHook(DirtyableDBObjectSet.class, dirtyableDBObjectSet.getDecodingTransformer());
  
              return dirtyableDBObjectSet;
          } else {
              return new BasicDBObject();
          }
      }