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

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

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

Settings.removeProperty介绍

暂无

代码示例

代码示例来源: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: SonarSource/sonarqube

/**
 * @see #setProperty(String, String)
 */
public Settings setProperty(String key, @Nullable Date date, boolean includeTime) {
 if (date == null) {
  return removeProperty(key);
 }
 return setProperty(key, includeTime ? DateUtils.formatDateTime(date) : DateUtils.formatDate(date));
}

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

@Test
public void publicRootUrl() {
 Settings settings = new MapSettings();
 ScannerWsClient client = mock(ScannerWsClient.class);
 when(client.baseUrl()).thenReturn("http://foo.com/");
 DefaultServer metadata = new DefaultServer(((MapSettings) settings).asConfig(), client, null);
 settings.setProperty(CoreProperties.SERVER_BASE_URL, "http://server.com/");
 assertThat(metadata.getPublicRootUrl()).isEqualTo("http://server.com");
 settings.removeProperty(CoreProperties.SERVER_BASE_URL);
 assertThat(metadata.getPublicRootUrl()).isEqualTo("http://foo.com");
}

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

public Settings setProperty(String key, @Nullable Date date, boolean includeTime) {
 if (date == null) {
  return removeProperty(key);
 }
 return setProperty(key, includeTime ? DateUtils.formatDateTime(date) : DateUtils.formatDate(date));
}

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

/**
 * @see #setProperty(String, String)
 */
public Settings setProperty(String key, @Nullable Date date, boolean includeTime) {
 if (date == null) {
  return removeProperty(key);
 }
 return setProperty(key, includeTime ? DateUtils.formatDateTime(date) : DateUtils.formatDate(date));
}

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

相关文章