Java Google Drive API v2-单亲模型强制如果enforceSingleParent未设置为TRUE,是否存在问题?
Google Drive developer关于删除对具有多个父项的文件的支持的通知(参考:),其中提到在插入文件时将参数“enforceSingleParent”设置为TRUE,以“选择API行为,使所有项都具有一个父项” 我已经将我的驱动器API v2升级到最新的Java版本1.30.10,但是Insert类没有“enforceSingleParent”的setter。我已确保我的任何API调用不再需要多个文件父级,并始终将父级值设置为单个父级文件夹ID。但是,API中对该值的描述使我想知道是否还有其他要求可用于确保顺利迁移Java Google Drive API v2-单亲模型强制如果enforceSingleParent未设置为TRUE,是否存在问题?,java,google-drive-api,Java,Google Drive Api,Google Drive developer关于删除对具有多个父项的文件的支持的通知(参考:),其中提到在插入文件时将参数“enforceSingleParent”设置为TRUE,以“选择API行为,使所有项都具有一个父项” 我已经将我的驱动器API v2升级到最新的Java版本1.30.10,但是Insert类没有“enforceSingleParent”的setter。我已确保我的任何API调用不再需要多个文件父级,并始终将父级值设置为单个父级文件夹ID。但是,API中对该值的描述使我想知道
除了确保不将文件设置为具有多个父级之外,还需要其他什么来支持这种单亲迁移吗?如果查看Drive.java的Github源代码,您将看到这种setter实际上存在 在Drive.java中的第行
/**
* Set to true to opt in to API behavior that aims for all items to have exactly one parent.
* This parameter only takes effect if the item is not in a shared drive. If the child's owner
* makes the request, the child is removed from all current folders and placed in the
* requested folder. Any other requests that increase the number of the child's parents fail,
* except when the canAddMyDriveParent file capability is true and a single parent is being
* added.
*/
public Insert setEnforceSingleParent(java.lang.Boolean enforceSingleParent) {
this.enforceSingleParent = enforceSingleParent;
return this;
}
使用示例:
File file = service.files().insert(fileContent).setEnforceSingleParent(true).execute();
如果不认识这种方法,这可能是一个过梁问题。例如,在IntelliJ IDEA中,它工作得很好
以下是有关如何正确更新项目中依赖项的一些说明:
参考文献
谢谢,我的朋友,IDE需要刷新