org.sonar.api.config.Settings.set()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(125)

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

Settings.set介绍

[英]Add the settings with the specified key and value, both are trimmed and neither can be null.
[中]使用指定的键和值添加设置,两者都会被修剪,并且都不能为null。

代码示例

代码示例来源:origin: SonarSource/sonarqube

/**
 * Change a property value in a restricted scope only, depending on execution context. New value
 * is <b>never</b> persisted. New value is ephemeral and kept in memory only:
 * <ul>
 *   <li>during current analysis in the case of scanner stack</li>
 *   <li>during processing of current HTTP request in the case of web server stack</li>
 *   <li>during execution of current task in the case of Compute Engine stack</li>
 * </ul>
 *
 * Property is temporarily removed if the parameter {@code value} is {@code null}
 */
public Settings setProperty(String key, @Nullable String value) {
 String validKey = definitions.validKey(key);
 if (value == null) {
  removeProperty(validKey);
 } else {
  set(validKey, trim(value));
 }
 return this;
}

代码示例来源:origin: org.sonarsource.sonarqube/sonar-plugin-api

/**
 * Change a property value in a restricted scope only, depending on execution context. New value
 * is <b>never</b> persisted. New value is ephemeral and kept in memory only:
 * <ul>
 *   <li>during current analysis in the case of scanner stack</li>
 *   <li>during processing of current HTTP request in the case of web server stack</li>
 *   <li>during execution of current task in the case of Compute Engine stack</li>
 * </ul>
 *
 * Property is temporarily removed if the parameter {@code value} is {@code null}
 */
public Settings setProperty(String key, @Nullable String value) {
 String validKey = definitions.validKey(key);
 if (value == null) {
  removeProperty(validKey);
 } else {
  set(validKey, trim(value));
 }
 return this;
}

相关文章