本文整理了Java中org.sonar.api.config.Settings.getRawString()
方法的一些代码示例,展示了Settings.getRawString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Settings.getRawString()
方法的具体详情如下:
包路径:org.sonar.api.config.Settings
类名称:Settings
方法名:getRawString
[英]The value that overrides the default value. It may be encrypted with a secret key. Use #getString(String) to get the effective and decrypted value.
[中]替代默认值的值。它可以用一个密钥加密。使用#getString(String)获取有效值和解密值。
代码示例来源:origin: SonarSource/sonarqube
/**
* @return {@code true} if the property has a non-default value, else {@code false}.
*/
public boolean hasKey(String key) {
return getRawString(key).isPresent();
}
代码示例来源:origin: SonarSource/sonarqube
@Override
protected Optional<String> get(String key) {
String value = localProperties.get(key);
if (value != null) {
return Optional.of(value);
}
return parentSettings.getRawString(key);
}
代码示例来源:origin: SonarSource/sonarqube
public Settings appendProperty(String key, @Nullable String value) {
Optional<String> existingValue = getRawString(definitions.validKey(key));
String newValue;
if (!existingValue.isPresent()) {
newValue = trim(value);
} else {
newValue = existingValue.get() + "," + trim(value);
}
return setProperty(key, newValue);
}
代码示例来源:origin: SonarSource/sonarqube
/**
* The effective value of the specified property. Can return
* {@code null} if the property is not set and has no
* defined default value.
* <p>
* If the property is encrypted with a secret key,
* then the returned value is decrypted.
* </p>
*
* @throws IllegalStateException if value is encrypted but fails to be decrypted.
*/
@CheckForNull
public String getString(String key) {
String effectiveKey = definitions.validKey(key);
Optional<String> value = getRawString(effectiveKey);
if (!value.isPresent()) {
// default values cannot be encrypted, so return value as-is.
return getDefaultValue(effectiveKey);
}
if (encryption.isEncrypted(value.get())) {
try {
return encryption.decrypt(value.get());
} catch (Exception e) {
throw new IllegalStateException("Fail to decrypt the property " + effectiveKey + ". Please check your secret key.", e);
}
}
return value.get();
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-plugin-api
/**
* @return {@code true} if the property has a non-default value, else {@code false}.
*/
public boolean hasKey(String key) {
return getRawString(key).isPresent();
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-server
@Override
protected Optional<String> get(String key) {
String value = localProperties.get(key);
if (value != null) {
return Optional.of(value);
}
return parentSettings.getRawString(key);
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-plugin-api
public Settings appendProperty(String key, @Nullable String value) {
Optional<String> existingValue = getRawString(definitions.validKey(key));
String newValue;
if (!existingValue.isPresent()) {
newValue = trim(value);
} else {
newValue = existingValue.get() + "," + trim(value);
}
return setProperty(key, newValue);
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-plugin-api
/**
* The effective value of the specified property. Can return
* {@code null} if the property is not set and has no
* defined default value.
* <p>
* If the property is encrypted with a secret key,
* then the returned value is decrypted.
* </p>
*
* @throws IllegalStateException if value is encrypted but fails to be decrypted.
*/
@CheckForNull
public String getString(String key) {
String effectiveKey = definitions.validKey(key);
Optional<String> value = getRawString(effectiveKey);
if (!value.isPresent()) {
// default values cannot be encrypted, so return value as-is.
return getDefaultValue(effectiveKey);
}
if (encryption.isEncrypted(value.get())) {
try {
return encryption.decrypt(value.get());
} catch (Exception e) {
throw new IllegalStateException("Fail to decrypt the property " + effectiveKey + ". Please check your secret key.", e);
}
}
return value.get();
}
内容来源于网络,如有侵权,请联系作者删除!