Skip to content

Instantly share code, notes, and snippets.

@octavian-nita
Created September 20, 2019 11:59
Show Gist options
  • Save octavian-nita/6e6d9a410c249edeadde47263db580c5 to your computer and use it in GitHub Desktop.
Save octavian-nita/6e6d9a410c249edeadde47263db580c5 to your computer and use it in GitHub Desktop.
package ...;
import static com.google.common.base.CaseFormat.*;
import static com.google.common.base.CharMatcher.is;
class CamelName {
static <E extends Enum<E>> String camelName(E enumValue) {
return enumValue == null ? null : UPPER_UNDERSCORE.to(LOWER_CAMEL, is('_').trimLeadingFrom(enumValue.name()));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment