本文整理汇总了Java中org.json.simple.JSONObject.size方法的典型用法代码示例。如果您正苦于以下问题:Java JSONObject.size方法的具体用法?Java JSONObject.size怎么用?Java JSONObject.size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.json.simple.JSONObject
的用法示例。
在下文中一共展示了JSONObject.size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseFavouriteSites
import org.json.simple.JSONObject; //导入方法依赖的package包/类
public static ListResponse<FavouriteSite> parseFavouriteSites(JSONObject jsonObject)
{
JSONObject jsonList = (JSONObject)jsonObject.get("list");
List<FavouriteSite> favouriteSites = new ArrayList<FavouriteSite>(jsonList.size());
if(jsonList != null)
{
JSONArray jsonEntries = (JSONArray)jsonList.get("entries");
if(jsonEntries != null)
{
for(int i = 0; i < jsonEntries.size(); i++)
{
JSONObject jsonEntry = (JSONObject)jsonEntries.get(i);
JSONObject entry = (JSONObject)jsonEntry.get("entry");
favouriteSites.add(parseFavouriteSite(entry));
}
}
}
ExpectedPaging paging = ExpectedPaging.parsePagination(jsonList);
return new ListResponse<FavouriteSite>(paging, favouriteSites);
}
示例2: getAllCredentials
import org.json.simple.JSONObject; //导入方法依赖的package包/类
public List<Credentials> getAllCredentials() throws IOException {
JSONObject currentAuths;
synchronized (this) {
loadCache();
currentAuths = auths;
}
List<Credentials> ret = new ArrayList<>(currentAuths.size());
for (Iterator it = currentAuths.entrySet().iterator(); it.hasNext();) {
Map.Entry e = (Map.Entry) it.next();
if (!(e.getKey() instanceof String)) {
continue;
}
String registry = (String) e.getKey();
JSONObject value = (JSONObject) e.getValue();
if (value == null) {
continue;
}
ret.add(createCredentials(registry, value)); // NOI18N
}
return ret;
}
示例3: Command
import org.json.simple.JSONObject; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public Command(String method, JSONObject params) {
command = new JSONObject();
command.put(COMMAND_ID, createUniqueID());
command.put(COMMAND_METHOD, method);
if (params != null && params.size() > 0) {
command.put(COMMAND_PARAMS, params);
}
}
示例4: createHar
import org.json.simple.JSONObject; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
private void createHar(String pt, String rt) {
Har<String, Log> har = new Har<>();
Page p = new Page(pt, har.pages());
har.addPage(p);
for (Object res : (JSONArray) JSONValue.parse(rt)) {
JSONObject jse = (JSONObject) res;
if (jse.size() > 14) {
Entry e = new Entry(jse.toJSONString(), p);
har.addEntry(e);
}
}
har.addRaw(pt, rt);
Control.ReportManager.addHar(har, (TestCaseReport) Report,
escapeName(Data));
}
示例5: getAchievements
import org.json.simple.JSONObject; //导入方法依赖的package包/类
public int getAchievements(){
JSONObject obj = (JSONObject) object("achievements");
return obj.size() - 1;
}