本文整理了Java中org.eclipse.che.plugin.yaml.shared.YamlPreference.<init>()
方法的一些代码示例,展示了YamlPreference.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlPreference.<init>()
方法的具体详情如下:
包路径:org.eclipse.che.plugin.yaml.shared.YamlPreference
类名称:YamlPreference
方法名:<init>
暂无
代码示例来源:origin: org.eclipse.che.plugin/che-plugin-yaml-ide
/**
* Add a url to Yaml Preferences
*
* @param url The url you would like to add to yaml preferences
*/
private void addUrlToPreferences(String url) {
YamlPreference pref = new YamlPreference(url, "/*");
this.yamlPreferences.add(pref);
}
代码示例来源:origin: org.eclipse.che.plugin/che-plugin-yaml-server
/**
* Converts json string to yaml preference
*
* @param jsonStr The json string you would like to change into Yaml Preferences
* @return List of Yaml Preferences
*/
private List<YamlPreference> jsonToYamlPreference(String jsonStr) {
List<YamlPreference> preferences = new ArrayList<YamlPreference>();
Type type = new TypeToken<Map<String, String[]>>() {}.getType();
Map<String, String[]> yamlPreferenceMap = new Gson().fromJson(jsonStr, type);
if (yamlPreferenceMap == null || "".equals(jsonStr)) {
return new ArrayList<YamlPreference>();
}
for (Map.Entry<String, String[]> yamlPreferenceMapItem : yamlPreferenceMap.entrySet()) {
for (String url : yamlPreferenceMapItem.getValue()) {
YamlPreference newYamlPref = new YamlPreference(url, yamlPreferenceMapItem.getKey());
preferences.add(newYamlPref);
}
}
return preferences;
}
代码示例来源:origin: org.eclipse.che.plugin/che-plugin-yaml-ide
/**
* Converts json string to list of Yaml Preferences
*
* @param jsonStr The json string to turn into the list of Yaml Preferences
* @return List of Yaml Preferences
*/
private List<YamlPreference> jsonToYamlPreference(String jsonStr) {
ArrayList yamlPreferences = new ArrayList<YamlPreference>();
JsonObject parsedJson = Json.parse(jsonStr);
for (String glob : parsedJson.keys()) {
try {
JsonArray jsonArray = parsedJson.getArray(glob);
for (int arrNum = 0; arrNum < jsonArray.length(); arrNum++) {
YamlPreference newYamlPref = new YamlPreference(jsonArray.getString(arrNum), glob);
yamlPreferences.add(newYamlPref);
}
} catch (Exception e) {
LOG.debug(e.getMessage(), e);
}
}
return yamlPreferences;
}
内容来源于网络,如有侵权,请联系作者删除!