繁体   English   中英

将对象数组转换为自定义类数组 java

[英]Cast Object array to custom class array java

我有一个对象数组,我试图将它转换为自定义“文档”类。 我试过以下:

 this.documentList = Arrays.copyOf(objectDocumentList, objectDocumentList.length,Document[].class);

 for(int i=0;i<this.objectDocumentList.length;i++){
     this.documentList[i]= (Document) objectDocumentList[i];
 }

我使用 Gson "toJson" 函数将我的对象转换为字符串,然后使用该字符串通过网络传递。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM