我有以下类,并提供带有键和值的实体名称HashMap
:
import java.util.LinkedHashMap;
public class ObjectStructure {
private String entityName;
private LinkedHashMap<String, String> keyVal;
public String getEntityName() {
return entityName;
}
public void setEntityName(String entityName) {
this.entityName = entityName;
}
public LinkedHashMap<String, String> getKeyVal() {
return keyVal;
}
public void setKeyVal(LinkedHashMap<String, String> keyVal) {
this.keyVal = keyVal;
}
}
我也列出如下
private static List<ObjectStructure> JsonObj = new ArrayList<ObjectStructure>();
因为我得到的JSON
对象是哪个列表,所以我需要按名称提供列表的方法(即entityName
可以有很多条目,我希望特定实体获取相应数据的列表)。我想我需要为它建立新的类,但我不知道如何设计它,有什么想法吗?