This commit is contained in:
Phillip Webb
2014-12-12 12:30:28 -08:00
parent 4c39073d2a
commit 5dd40e6999
4 changed files with 67 additions and 65 deletions

View File

@@ -80,19 +80,20 @@ public class ConfigurationMetadata {
Matcher matcher = CAMEL_CASE_PATTERN.matcher(name);
StringBuffer result = new StringBuffer();
while (matcher.find()) {
String first = matcher.group(1);
String second = matcher.group(2);
String target;
if (first.equals("_")) { // not a word for the binder
target = first + second;
} else {
target = first + "-" + second;
}
matcher.appendReplacement(result,target);
matcher.appendReplacement(result, getDashed(matcher));
}
matcher.appendTail(result);
String value = result.toString();
return value.toLowerCase();
return result.toString().toLowerCase();
}
private static String getDashed(Matcher matcher) {
String first = matcher.group(1);
String second = matcher.group(2);
if (first.equals("_")) {
// not a word for the binder
return first + second;
}
return first + "-" + second;
}
}