gpt4 book ai didi

org.eclipse.che.plugin.yaml.shared.YamlPreference.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 02:03:31 33 4
gpt4 key购买 nike

本文整理了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>

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;
}

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com