本文整理了Java中net.sf.json.JSONArray.getString()
方法的一些代码示例,展示了JSONArray.getString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONArray.getString()
方法的具体详情如下:
包路径:net.sf.json.JSONArray
类名称:JSONArray
方法名:getString
暂无
代码示例来源:origin: jenkinsci/jenkins
/**
* Installs a list of plugins from a JSON POST.
* @param req The request object.
* @return A JSON response that includes a "correlationId" in the "data" element.
* That "correlationId" can then be used in calls to
* {@link UpdateCenter#doInstallStatus(org.kohsuke.stapler.StaplerRequest)}.
* @throws IOException Error reading JSON payload fro request.
*/
@RequirePOST
@Restricted(DoNotUse.class) // WebOnly
public HttpResponse doInstallPlugins(StaplerRequest req) throws IOException {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
String payload = IOUtils.toString(req.getInputStream(), req.getCharacterEncoding());
JSONObject request = JSONObject.fromObject(payload);
JSONArray pluginListJSON = request.getJSONArray("plugins");
List<String> plugins = new ArrayList<>();
for (int i = 0; i < pluginListJSON.size(); i++) {
plugins.add(pluginListJSON.getString(i));
}
UUID correlationId = UUID.randomUUID();
try {
boolean dynamicLoad = request.getBoolean("dynamicLoad");
install(plugins, dynamicLoad, correlationId);
JSONObject responseData = new JSONObject();
responseData.put("correlationId", correlationId.toString());
return hudson.util.HttpResponses.okJSON(responseData);
} catch (Exception e) {
return hudson.util.HttpResponses.errorJSON(e.getMessage());
}
}
代码示例来源:origin: jenkinsci/jenkins
if (protocols instanceof JSONArray) {
for (int i = 0; i < ((JSONArray) protocols).size(); i++) {
agentProtocols.add(((JSONArray) protocols).getString(i));
代码示例来源:origin: com.aliyun.openservices/aliyun-log
@Override
public String unmarshal(JSONArray value, int index) {
return value.getString(index);
}
});
代码示例来源:origin: aliyun/aliyun-log-java-sdk
@Override
public String unmarshal(JSONArray value, int index) {
return value.getString(index);
}
});
代码示例来源:origin: com.aliyun.openservices/aliyun-log
private List<String> FromJsonArray(JSONArray jsonArray) {
List<String> list = new ArrayList<String>();
for (int i = 0; i < jsonArray.size(); i++) {
list.add(jsonArray.getString(i));
}
return list;
}
代码示例来源:origin: com.aliyun.openservices/aliyun-log
public void SetMachineList(JSONArray machineListJSONArray) {
machineList = new ArrayList<String>();
for(int i = 0;i < machineListJSONArray.size();i++) {
String machine = machineListJSONArray.getString(i);
machineList.add(machine);
}
}
代码示例来源:origin: aliyun/aliyun-log-java-sdk
public void SetMachineList(JSONArray machineListJSONArray) {
machineList = new ArrayList<String>();
for(int i = 0;i < machineListJSONArray.size();i++) {
String machine = machineListJSONArray.getString(i);
machineList.add(machine);
}
}
代码示例来源:origin: com.aliyun.openservices/aliyun-log
public void SetMachineList(JSONArray machineListJSONArray) {
machineList = new ArrayList<String>();
for(int i = 0;i < machineListJSONArray.size();i++) {
String machine = machineListJSONArray.getString(i);
machineList.add(machine);
}
}
代码示例来源:origin: aliyun/aliyun-log-java-sdk
public void SetMachineList(JSONArray machineListJSONArray) {
machineList = new ArrayList<String>();
for(int i = 0;i < machineListJSONArray.size();i++) {
String machine = machineListJSONArray.getString(i);
machineList.add(machine);
}
}
代码示例来源:origin: com.aliyun.openservices/aliyun-log
private List<String> ExtractJsonArray(JSONArray ojbect) {
ArrayList<String> result = new ArrayList<String>();
try {
for (int i = 0; i < ojbect.size(); i++) {
result.add(ojbect.getString(i));
}
} catch (JSONException e) {
// ignore
}
return result;
}
代码示例来源:origin: com.aliyun.openservices/aliyun-log
protected ArrayList<String> ExtractConfigsFromResponse(JSONObject object) {
ArrayList<String> configs = new ArrayList<String>();
JSONArray configobj = object.getJSONArray("configs");
for (int i = 0; i < configobj.size(); ++i) {
configs.add(configobj.getString(i));
}
return configs;
}
代码示例来源:origin: com.aliyun.openservices/aliyun-log
protected ArrayList<String> ExtractConfigMachineGroupFromResponse(JSONObject object) {
ArrayList<String> configs = new ArrayList<String>();
JSONArray configobj = object.getJSONArray("machinegroups");
for (int i = 0; i < configobj.size(); ++i) {
configs.add(configobj.getString(i));
}
return configs;
}
代码示例来源:origin: aliyun/aliyun-log-java-sdk
protected ArrayList<String> ExtractConfigsFromResponse(JSONObject object) {
ArrayList<String> configs = new ArrayList<String>();
JSONArray configobj = object.getJSONArray("configs");
for (int i = 0; i < configobj.size(); ++i) {
configs.add(configobj.getString(i));
}
return configs;
}
代码示例来源:origin: com.aliyun.openservices/aliyun-log
public void SetKey(JSONArray key) throws LogException {
try {
this.key = new ArrayList<String>();
for (int i = 0; i < key.size(); i++) {
this.key.add(key.getString(i));
}
} catch (JSONException e) {
throw new LogException("FailToSetKey", e.getMessage(), e, "");
}
}
代码示例来源:origin: aliyun/aliyun-log-java-sdk
public void SetShardHashKey(JSONArray shardHashKey) throws LogException {
try {
this.shardHashKey = new ArrayList<String>();
for (int i = 0; i < shardHashKey.size(); i++)
this.shardHashKey.add(shardHashKey.getString(i));
} catch (JSONException e) {
throw new LogException("FailToSetShardHashKey", e.getMessage(), e, "");
}
}
代码示例来源:origin: com.aliyun.openservices/aliyun-log
public void SetFilterRegex(JSONArray filterRegex) throws LogException {
try {
this.filterRegex = new ArrayList<String>();
for (int i = 0; i < filterRegex.size(); i++) {
this.filterRegex.add(filterRegex.getString(i));
}
} catch (JSONException e) {
throw new LogException("FailToSetFilterRegex", e.getMessage(), e, "");
}
}
代码示例来源:origin: aliyun/aliyun-log-java-sdk
public void SetKey(JSONArray key) throws LogException {
try {
this.key = new ArrayList<String>();
for (int i = 0; i < key.size(); i++) {
this.key.add(key.getString(i));
}
} catch (JSONException e) {
throw new LogException("FailToSetKey", e.getMessage(), e, "");
}
}
代码示例来源:origin: com.aliyun.openservices/aliyun-log
public void SetShardHashKey(JSONArray shardHashKey) throws LogException {
try {
this.shardHashKey = new ArrayList<String>();
for (int i = 0; i < shardHashKey.size(); i++)
this.shardHashKey.add(shardHashKey.getString(i));
} catch (JSONException e) {
throw new LogException("FailToSetShardHashKey", e.getMessage(), e, "");
}
}
代码示例来源:origin: com.aliyun.openservices/aliyun-log
public void SetFilterKey(JSONArray filterKey) throws LogException {
try {
this.filterKey = new ArrayList<String>();
for (int i = 0; i < filterKey.size(); i++) {
this.filterKey.add(filterKey.getString(i));
}
} catch (JSONException e) {
throw new LogException("FailToSetFilterKey", e.getMessage(), e, "");
}
}
代码示例来源:origin: com.aliyun.openservices/aliyun-log
public void SetKey(JSONArray key) throws LogException {
try {
this.key = new ArrayList<String>();
for (int i = 0; i < key.size(); i++) {
this.key.add(key.getString(i));
}
} catch (JSONException e) {
throw new LogException("FailToSetKey", e.getMessage(), e, "");
}
}
内容来源于网络,如有侵权,请联系作者删除!