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

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

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

Settings.getKeysStartingWith介绍

暂无

代码示例

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

private static void completeProperties(Settings settings, Properties properties, String prefix) {
 List<String> jdbcKeys = settings.getKeysStartingWith(prefix);
 for (String jdbcKey : jdbcKeys) {
  String value = settings.getString(jdbcKey);
  properties.setProperty(jdbcKey, value);
 }
}

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

@Test
public void getKeysStartingWith() {
 Settings settings = new MapSettings();
 settings.setProperty("sonar.jdbc.url", "foo");
 settings.setProperty("sonar.jdbc.username", "bar");
 settings.setProperty("sonar.security", "admin");
 assertThat(settings.getKeysStartingWith("sonar")).containsOnly("sonar.jdbc.url", "sonar.jdbc.username", "sonar.security");
 assertThat(settings.getKeysStartingWith("sonar.jdbc")).containsOnly("sonar.jdbc.url", "sonar.jdbc.username");
 assertThat(settings.getKeysStartingWith("other")).hasSize(0);
}

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

for (String key : settings.getKeysStartingWith("sonar.jdbc")) {
 LOG.info(key + ": " + settings.getString(key));

代码示例来源:origin: org.sonarsource.sonarqube/sonar-db-core

private static void completeProperties(Settings settings, Properties properties, String prefix) {
 List<String> jdbcKeys = settings.getKeysStartingWith(prefix);
 for (String jdbcKey : jdbcKeys) {
  String value = settings.getString(jdbcKey);
  properties.setProperty(jdbcKey, value);
 }
}

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

private static void completeProperties(Settings settings, Properties properties, String prefix) {
 List<String> jdbcKeys = settings.getKeysStartingWith(prefix);
 for (String jdbcKey : jdbcKeys) {
  String value = settings.getString(jdbcKey);
  properties.setProperty(jdbcKey, value);
 }
}

代码示例来源:origin: Pablissimo/SonarTsPlugin

private void loadCustomRules() {
  if (this.settings == null)
    return;
  if (settings.getBoolean(TypeScriptPlugin.SETTING_TS_LINT_DISALLOW_CUSTOM_RULES)) {
    LOG.info("Usage of custom rules is inhibited");
    return;
  }
  List<String> configKeys = settings.getKeysStartingWith(TypeScriptPlugin.SETTING_TS_RULE_CONFIGS);
  for (String cfgKey : configKeys) {
    if (!cfgKey.endsWith("config")) {
      continue;
    }
    String rulesConfig = settings.getString(cfgKey);
    if (rulesConfig != null) {
      InputStream rulesConfigStream = new ByteArrayInputStream(rulesConfig.getBytes(Charset.defaultCharset()));
      loadRules(rulesConfigStream, tslintRules);
    }
  }
}

相关文章