[英]How would I create a POJO class for such a data structure?
My data structure in firestore database is supposed to look like this我在 firestore 数据库中的数据结构应该是这样的
As from the image, the our_array
field, is an array that contains fields of data type - Map inside it.如图所示, our_array
字段是一个数组,其中包含数据类型为 Map 的字段。
I need to create a simple POJO in order to insert the data as designed.我需要创建一个简单的 POJO 以便按设计插入数据。
My current POJO class:我目前的 POJO class:
class ProductList{
private boolean availability;
private Object[] our_array; //I have doubts about this one
private String product_title;
… //Getters & setters
}
How can I structure the above data set, spefically the our_maps
array that contains Map(s) inside it?如何构建上述数据集,特别是其中包含 Map(s) 的our_maps
数组?
First create a Product pojo:首先创建一个产品 pojo:
class Product {
private String productName;
…
…
// getters / setters
}
then your ProductList class could have a list of Products instead:那么您的 ProductList class 可能有一个产品列表:
class ProductList {
private boolean availability;
private List<Product> our_productList;
...
//Getters & setters
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.