gpt4 book ai didi

org.eclipse.che.plugin.yaml.shared.YamlPreference类的使用及代码示例

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

本文整理了Java中org.eclipse.che.plugin.yaml.shared.YamlPreference类的一些代码示例,展示了YamlPreference类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlPreference类的具体详情如下:
包路径:org.eclipse.che.plugin.yaml.shared.YamlPreference
类名称:YamlPreference

YamlPreference介绍

[英]Establishes the format for Yaml Preferences
[中]建立Yaml首选项的格式

代码示例

代码示例来源: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-ide

@Override
public String getValue(YamlPreference object) {
 return object.getGlob();
}

代码示例来源:origin: org.eclipse.che.plugin/che-plugin-yaml-ide

@Override
public String getValue(YamlPreference object) {
 return object.getUrl();
}

代码示例来源:origin: org.eclipse.che.plugin/che-plugin-yaml-shared

/**
  * Converts List of Yaml Preferences to Map of Globs to List of urls
  *
  * @param pref The list of Yaml Preferences you want to convert
  * @return Map of Globs to List of urls of the Yaml Preferences
  */
 public static Map<String, List<String>> yamlPreferenceToMap(List<YamlPreference> pref) {
  Map<String, List<String>> preferenceMap = new HashMap<String, List<String>>();

  for (YamlPreference prefItr : pref) {

   if (preferenceMap.containsKey(prefItr.getGlob())) {
    ArrayList<String> prefList = new ArrayList<String>(preferenceMap.get(prefItr.getGlob()));
    prefList.add(prefItr.getUrl());
    preferenceMap.put(prefItr.getGlob(), prefList);
   } else {
    ArrayList<String> prefList = new ArrayList<String>();
    prefList.add(prefItr.getUrl());
    preferenceMap.put(prefItr.getGlob(), prefList);
   }
  }

  return preferenceMap;
 }
}

代码示例来源:origin: org.eclipse.che.plugin/che-plugin-yaml-ide

@Override
 public void update(int index, YamlPreference object, String value) {
  object.setUrl(value);
  delegate.nowDirty();
 }
});

代码示例来源:origin: org.eclipse.che.plugin/che-plugin-yaml-ide

@Override
 public void update(int index, YamlPreference object, String value) {
  object.setGlob(value);
  delegate.nowDirty();
 }
});

代码示例来源: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;
}

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