in core/src/main/java/com/twitter/elephantbird/util/Strings.java [57:96]
public static String camelize(String word, boolean lowercaseFirstLetter) {
// Replace all slashes with dots (package separator)
Pattern p = Pattern.compile("\\/(.?)");
Matcher m = p.matcher(word);
while (m.find()) {
word = m.replaceFirst("." + m.group(1)/*.toUpperCase()*/);
m = p.matcher(word);
}
// Uppercase the class name.
p = Pattern.compile("(\\.?)(\\w)([^\\.]*)$");
m = p.matcher(word);
if (m.find()) {
String rep = m.group(1) + m.group(2).toUpperCase() + m.group(3);
rep = rep.replaceAll("\\$", "\\\\\\$");
word = m.replaceAll(rep);
}
// Replace two underscores with $ to support inner classes.
p = Pattern.compile("(__)(.)");
m = p.matcher(word);
while (m.find()) {
word = m.replaceFirst("\\$" + m.group(2).toUpperCase());
m = p.matcher(word);
}
// Remove all underscores
p = Pattern.compile("(_)(.)");
m = p.matcher(word);
while (m.find()) {
word = m.replaceFirst(m.group(2).toUpperCase());
m = p.matcher(word);
}
if (lowercaseFirstLetter) {
word = word.substring(0, 1).toLowerCase() + word.substring(1);
}
return word;
}