当前位置: 首页>>代码示例>>Java>>正文


Java JSONArray.iterator方法代码示例

本文整理汇总了Java中org.json.simple.JSONArray.iterator方法的典型用法代码示例。如果您正苦于以下问题:Java JSONArray.iterator方法的具体用法?Java JSONArray.iterator怎么用?Java JSONArray.iterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.json.simple.JSONArray的用法示例。


在下文中一共展示了JSONArray.iterator方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import org.json.simple.JSONArray; //导入方法依赖的package包/类
public static ExecutionEventObject create(JSONObject obj, ExecutionEvent.Type t) {
    Long count = (Long) obj.get("prjcount");
    int prjCount = -1;
    if (count != null) {
        prjCount = count.intValue();
    }
    ExecSession toRet = new ExecSession(prjCount, t);
    JSONArray arr = (JSONArray) obj.get("mvncoreurls");
    if (arr != null) {
        List<URL> urlList = new ArrayList<URL>();
        Iterator it = arr.iterator();
        while (it.hasNext()) {
            String url = (String) it.next();
            try {
                urlList.add(new URL(url));
            } catch (MalformedURLException ex) {
                Exceptions.printStackTrace(ex);
            }
        }
        toRet.setMnvcoreurls(urlList.toArray(new URL[0]));
    }
    
    return toRet;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:ExecSession.java

示例2: getBrData

import org.json.simple.JSONArray; //导入方法依赖的package包/类
public ObservableList<Browsers> getBrData() {

        try {
            if (new File(jsonFile).exists()) {
                Object obj = parser.parse(new FileReader(jsonFile));
                JSONObject jsonObject = (JSONObject) obj;
                JSONArray caps = (JSONArray) jsonObject.get("capabilities");
                Iterator<JSONObject> iterator = caps.iterator();
                List<Browsers> brList = new ArrayList<>();

                while (iterator.hasNext()) {
                    JSONObject objt = iterator.next();
                    brList.add(new Browsers(objt.get("browserName").toString(), objt.get("maxInstances").toString()));
                }

                ObservableList<Browsers> data = FXCollections.observableArrayList(brList);
                return data;
            }
        } catch (IOException | ParseException ex) {
            Logger.getLogger(ParseJSON.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;
    }
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:24,代码来源:ParseJSON.java

示例3: getExecutionID

import org.json.simple.JSONArray; //导入方法依赖的package包/类
/**
 * 
 * @param testcase
 * @param cyclePhaseId
 * @param client
 * @return 
 */
private int getExecutionID(String testcase, int cyclePhaseId, ZephyrHttpClient client) {
    int tcaseId = getTestCaseId(testcase, client);
    if (tcaseId == -1) {
        return -1;
    }
    int executionId = -1;
    try {
        String url = client.url + EXELIST + "?cyclephaseid=" + URLEncoder.encode(Integer.toString(cyclePhaseId), "UTF-8");
        DLogger.Log("Req Execution ID ", url);
        JSONObject releaseList = client.Get(new URL(url));
        DLogger.Log("Looking for [", cyclePhaseId, "] in", releaseList);
        JSONArray exeList = (JSONArray) releaseList.get("array");
        Iterator exeiter = exeList.iterator();
        while (exeiter.hasNext()) {
            JSONObject exeObj = (JSONObject) exeiter.next();
            int remoteTc = Integer.valueOf(exeObj.get("remoteTestcaseId").toString());
            if (tcaseId == remoteTc) {
                executionId = Integer.valueOf(exeObj.get("testScheduleId").toString());
                break;
            }
        }
        if (executionId == -1) {
            DLogger.LogE("CyclePhaseId [", cyclePhaseId, "] not found");
        }
    } catch (Exception ex) {
        Logger.getLogger(ZephyrClient.class.getName()).log(Level.SEVERE, null, ex);
    }
    return executionId;
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:37,代码来源:ZephyrClient.java

示例4: parseNetwork

import org.json.simple.JSONArray; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public static NetworkImpl parseNetwork(JSONObject jsonObject)
{
	String id = (String)jsonObject.get("id");
	Boolean isEnabled = (Boolean)jsonObject.get("isEnabled");
	Boolean paidNetwork = (Boolean)jsonObject.get("paidNetwork");
	String createdAt = (String)jsonObject.get("createdAt");
	String subscriptionLevel = (String)jsonObject.get("subscriptionLevel");
	JSONArray quotasJSON = (JSONArray)jsonObject.get("quotas");
	List<org.alfresco.rest.api.tests.client.data.Quota> quotas = new ArrayList<org.alfresco.rest.api.tests.client.data.Quota>(quotasJSON.size());
	Iterator it = quotasJSON.iterator();
	while(it.hasNext())
	{
		JSONObject quotaJSON = (JSONObject)it.next();
		org.alfresco.rest.api.tests.client.data.Quota quota = org.alfresco.rest.api.tests.client.data.Quota.parseQuota(quotaJSON);
		quotas.add(quota);
	}
	NetworkImpl network = new NetworkImpl(id, isEnabled, createdAt, quotas, subscriptionLevel, paidNetwork);
	return network;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:21,代码来源:NetworkImpl.java

示例5: getParsedNotifications

import org.json.simple.JSONArray; //导入方法依赖的package包/类
/**
 * Parses a list of Jodel-notifications
 * @param notificationsJSON String containing a JSON with notifications
 * @return A list of objects from type JodelNotification
 */
public static List<JodelNotification> getParsedNotifications(String notificationsJSON) {
    List<JodelNotification> jodelNotifications = new ArrayList<JodelNotification>();
    JSONParser parser = new JSONParser();
    try {
        JSONObject responseJson = (JSONObject) parser.parse(notificationsJSON);
        JSONArray jodelsNotificationsArray = (JSONArray) responseJson.get("notifications");

        Iterator i = jodelsNotificationsArray.iterator();
        while (i.hasNext()) {
            JSONObject notification = (JSONObject) i.next();
            JodelNotification jodelNotification = new JodelNotification();
            jodelNotification.postID = (String) notification.get("post_id");
            jodelNotification.type = (String) notification.get("type");
            jodelNotification.userID = (String) notification.get("user_id");
            jodelNotification.message = (String) notification.get("message");
            if (jodelNotification.type.equals("vote_post")) {
                jodelNotification.voteCount = (long) notification.get("vote_count");
            }
            ;
            jodelNotification.scroll = (String) notification.get("scroll");
            jodelNotification.lastInteraction = (String) notification.get("last_interaction");
            jodelNotification.read = (boolean) notification.get("read");
            jodelNotification.seen = (boolean) notification.get("seen");
            jodelNotification.color = (String) notification.get("color");
            jodelNotification.notificationID = (String) notification.get("notification_id");

            jodelNotifications.add(jodelNotification);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return jodelNotifications;
}
 
开发者ID:fr31b3u73r,项目名称:JodelAPI,代码行数:39,代码来源:JodelParser.java

示例6: getArray

import org.json.simple.JSONArray; //导入方法依赖的package包/类
public ArrayList<HttpJsonObject> getArray(String key)
{
    JSONArray jsonArray = (JSONArray)((JSONObject)item).get(key);
    Iterator<JSONObject> iterJsonArray = jsonArray.iterator();

    ArrayList<HttpJsonObject> list = new ArrayList<HttpJsonObject>();

    while (iterJsonArray.hasNext())
    {
        JSONObject jsonObject = iterJsonArray.next();
        list.add(new HttpJsonObject(jsonObject));
    }

    return list;
}
 
开发者ID:setreuid,项目名称:httpjson,代码行数:16,代码来源:HttpJsonObject.java

示例7: MessageSnippetIterator

import org.json.simple.JSONArray; //导入方法依赖的package包/类
/**
 * Creates a new instance.
 *
 * @param array The JSON array.
 */
public MessageSnippetIterator(JSONArray array) {
    this.iterator = array.iterator();
}
 
开发者ID:Fylipp,项目名称:easy-http-console,代码行数:9,代码来源:MessageSnippetIterator.java

示例8: getCyclePhaseID

import org.json.simple.JSONArray; //导入方法依赖的package包/类
/**
 * 
 * @param testSet
 * @param releaseID
 * @param phase
 * @param client
 * @return 
 */
private int getCyclePhaseID(String testSet, int releaseID, String phase, ZephyrHttpClient client) {
    int cycleId = -1;
    try {
        String url = client.url + CYCLELIST + "?releaseId=" + URLEncoder.encode(Integer.toString(releaseID), "UTF-8");
        DLogger.Log("Req CyclePhase ID ", url);
        JSONObject releaseList = client.Get(new URL(url));
        DLogger.Log("Looking for [", testSet, "] in", releaseList);
        for (Object proj : (Iterable<? extends Object>) releaseList
                .get("array")) {
            String id = ((Map<?, ?>) proj).get(ZephyrClient.array.NAME).toString();
            if (Objects.equals(id, testSet)) {
                JSONArray remotePhases = (JSONArray) ((Map<?, ?>) proj).get(ZephyrClient.array.REMOTE_PHASES);
                Iterator remotePhase = remotePhases.iterator();
                while (remotePhase.hasNext()) {
                    JSONObject testphase = (JSONObject) remotePhase.next();
                    String phaseName = ((JSONObject) ((JSONObject) (testphase).get(ZephyrClient.array.REMOTE_REPO)).get("remoteData")).get(ZephyrClient.array.NAME).toString();
                    if (Objects.equals(phaseName, phase)) {
                        cycleId = Integer.valueOf(testphase.get(ZephyrClient.array.ID).toString());
                        break;
                    }
                }
            }
        }
        if (cycleId == -1) {
            DLogger.LogE("Phase [", phase, "] not found");
        }
    } catch (Exception ex) {
        Logger.getLogger(ZephyrClient.class.getName()).log(Level.SEVERE, null, ex);
    }
    return cycleId;
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:40,代码来源:ZephyrClient.java


注:本文中的org.json.simple.JSONArray.iterator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。