Use chars rather than strings

Update `SystemEnvironmentPropertyMapper` to use single chars
rather than strings whenever possible.

See gh-21523
This commit is contained in:
dreis2211 2020-06-05 15:51:28 -07:00 committed by Phillip Webb
parent de8970ec8e
commit 33deba4948
1 changed files with 3 additions and 3 deletions

View File

@ -58,7 +58,7 @@ final class SystemEnvironmentPropertyMapper implements PropertyMapper {
StringBuilder result = new StringBuilder();
for (int i = 0; i < numberOfElements; i++) {
if (result.length() > 0) {
result.append("_");
result.append('_');
}
result.append(name.getElement(i, Form.UNIFORM).toUpperCase(Locale.ENGLISH));
}
@ -69,7 +69,7 @@ final class SystemEnvironmentPropertyMapper implements PropertyMapper {
StringBuilder result = new StringBuilder();
for (int i = 0; i < name.getNumberOfElements(); i++) {
if (result.length() > 0) {
result.append("_");
result.append('_');
}
result.append(convertLegacyNameElement(name.getElement(i, Form.ORIGINAL)));
}
@ -118,7 +118,7 @@ final class SystemEnvironmentPropertyMapper implements PropertyMapper {
}
StringBuilder legacyCompatibleName = new StringBuilder();
for (int i = 0; i < name.getNumberOfElements(); i++) {
legacyCompatibleName.append((i != 0) ? "." : "");
legacyCompatibleName.append((i != 0) ? '.' : "");
legacyCompatibleName.append(name.getElement(i, Form.DASHED).replace('-', '.'));
}
return ConfigurationPropertyName.isValid(legacyCompatibleName)