private <T> T makeWithJSONCreator(ObjectId id, Class<T> type, DBObject rawData) {
   if (seen.contains(id))
     throw new IllegalArgumentException("Circularity when trying to construct " + id.toString());
   seen.add(id);
   // XXX: we end up unmarshalling the document twice in this case
   return unmarshaller.unmarshall(Bson.createDocument(rawData), type, this);
 }
  public ObjBase makeValue(ObjectId id, DBObject rawData, Class<? extends ObjBase> c) {

    if (Modifier.isAbstract(c.getModifiers()) || Modifier.isInterface(c.getModifiers())) {
      // extract declared schema from result, use that class
      Object schemaId = rawData.get(ReservedFieldNames.SCHEMA);
      try {
        c = (Class<ObjBase>) ClassUtil.findClass(schemaId.toString());
      } catch (ClassNotFoundException ex) {
        log.warn("Could not find fallback schema {}", schemaId);
        return null;
      }
    }

    ObjBase value = makeStub(id, c, rawData);
    // update stub with the rest of the data,
    if (value != null && !(value instanceof Swappable))
      try {
        unmarshaller.unmarshall(Bson.createDocument(rawData), value, this);
      } catch (MarshallingException me) {
        log.warn(me.getMessage(), me);
      }

    return value;
  }