本文整理汇总了Java中org.sonar.wsclient.jsonsimple.JSONValue类的典型用法代码示例。如果您正苦于以下问题:Java JSONValue类的具体用法?Java JSONValue怎么用?Java JSONValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JSONValue类属于org.sonar.wsclient.jsonsimple包,在下文中一共展示了JSONValue类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getScmData
import org.sonar.wsclient.jsonsimple.JSONValue; //导入依赖的package包/类
private Map<Integer, LineData> getScmData(String fileKey) throws ParseException {
Map<Integer, LineData> result = new HashMap<Integer, LineData>();
String json = orchestrator.getServer().adminWsClient().get("api/sources/scm", "commits_by_line", "true", "key", fileKey);
JSONObject obj = (JSONObject) JSONValue.parse(json);
JSONArray array = (JSONArray) obj.get("scm");
for (int i = 0; i < array.size(); i++) {
JSONArray item = (JSONArray) array.get(i);
// Time part was added in 5.2
String dateOrDatetime = (String) item.get(2);
// Revision was added in 5.2
result.put(((Long) item.get(0)).intValue(), IS_5_2_OR_MORE ? new LineData((String) item.get(3),
dateOrDatetime, (String) item.get(1)) : new LineData(dateOrDatetime, (String) item.get(1)));
}
return result;
}
开发者ID:SonarSource,项目名称:sonar-scm-svn,代码行数:17,代码来源:SvnTest.java
示例2: getRuleKeysFromRepository
import org.sonar.wsclient.jsonsimple.JSONValue; //导入依赖的package包/类
private static Set<String> getRuleKeysFromRepository(Orchestrator orchestrator, String language) {
Set<String> ruleKeys = new HashSet<>();
String json = new HttpRequestFactory(orchestrator.getServer().getUrl())
.get("/api/rules/search", ImmutableMap.<String, Object>of("languages", language, "repositories", language, "ps", "1000"));
@SuppressWarnings("unchecked")
List<Map> jsonRules = (List<Map>) ((Map) JSONValue.parse(json)).get("rules");
for (Map jsonRule : jsonRules) {
String key = ((String) jsonRule.get("key")).substring(language.length() + 1);
ruleKeys.add(key);
}
return ruleKeys;
}
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:13,代码来源:ProfileGenerator.java
示例3: getRuleKeysFromRepository
import org.sonar.wsclient.jsonsimple.JSONValue; //导入依赖的package包/类
private static Set<String> getRuleKeysFromRepository(Orchestrator orchestrator) {
Set<String> ruleKeys = new HashSet<>();
String json = new HttpRequestFactory(orchestrator.getServer().getUrl())
.get("/api/rules/search", ImmutableMap.<String, Object>of("languages", "gherkin", "repositories", "gherkin", "ps", "1000"));
@SuppressWarnings("unchecked")
List<Map> jsonRules = (List<Map>) ((Map) JSONValue.parse(json)).get("rules");
for (Map jsonRule : jsonRules) {
String key = ((String) jsonRule.get("key")).substring(8);
ruleKeys.add(key);
}
return ruleKeys;
}
开发者ID:racodond,项目名称:sonar-gherkin-plugin,代码行数:13,代码来源:ProfileGenerator.java
示例4: getScmData
import org.sonar.wsclient.jsonsimple.JSONValue; //导入依赖的package包/类
private Map<Integer, LineData> getScmData(String fileKey) throws ParseException {
Map<Integer, LineData> result = new HashMap<>();
String json = orchestrator.getServer().adminWsClient().get("api/sources/scm", "commits_by_line", "true", "key", fileKey);
JSONObject obj = (JSONObject) JSONValue.parse(json);
JSONArray array = (JSONArray) obj.get("scm");
for (Object anArray : array) {
JSONArray item = (JSONArray) anArray;
String dateOrDatetime = (String) item.get(2);
result.put(((Long) item.get(0)).intValue(), new LineData((String) item.get(3),
dateOrDatetime, (String) item.get(1)));
}
return result;
}
开发者ID:SonarSource,项目名称:sonar-scm-git,代码行数:14,代码来源:GitTest.java
示例5: getRuleKeysFromRepository
import org.sonar.wsclient.jsonsimple.JSONValue; //导入依赖的package包/类
private static Set<String> getRuleKeysFromRepository(String repository, Orchestrator orchestrator) {
Set<String> ruleKeys = new HashSet<>();
String json = new HttpRequestFactory(orchestrator.getServer().getUrl())
.get("/api/rules/search", ImmutableMap.of("languages", "jproperties", "repositories", repository, "ps", "1000"));
@SuppressWarnings("unchecked")
List<Map> jsonRules = (List<Map>) ((Map) JSONValue.parse(json)).get("rules");
for (Map jsonRule : jsonRules) {
String key = ((String) jsonRule.get("key")).substring(repository.length() + 1);
ruleKeys.add(key);
}
return ruleKeys;
}
开发者ID:racodond,项目名称:sonar-jproperties-plugin,代码行数:13,代码来源:ProfileGenerator.java
示例6: getRuleKeysFromRepository
import org.sonar.wsclient.jsonsimple.JSONValue; //导入依赖的package包/类
private static Set<String> getRuleKeysFromRepository(Orchestrator orchestrator) {
Set<String> ruleKeys = new HashSet<>();
String json = new HttpRequestFactory(orchestrator.getServer().getUrl())
.get("/api/rules/search", ImmutableMap.<String, Object>of("languages", "json", "repositories", "json", "ps", "1000"));
@SuppressWarnings("unchecked")
List<Map> jsonRules = (List<Map>) ((Map) JSONValue.parse(json)).get("rules");
for (Map jsonRule : jsonRules) {
String key = ((String) jsonRule.get("key")).substring(5);
ruleKeys.add(key);
}
return ruleKeys;
}
开发者ID:racodond,项目名称:sonar-json-plugin,代码行数:13,代码来源:ProfileGenerator.java
注:本文中的org.sonar.wsclient.jsonsimple.JSONValue类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论