de.zalando.sprocwrapper.util.NameUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zalando-sprocwrapper Show documentation
Show all versions of zalando-sprocwrapper Show documentation
Library to make PostgreSQL stored procedures available through simple Java "*SProcService" interfaces
including automatic object serialization and deserialization (using typemapper and
convention-over-configuration). Supports sharding, advisory locking, statement timeouts and PostgreSQL types
such as enums and hstore.
package de.zalando.sprocwrapper.util;
import java.util.Locale;
import com.google.common.base.Preconditions;
/**
* Static utility methods for naming conventions.
*
* @author pribeiro
*/
public final class NameUtils {
private NameUtils() { }
public static String camelCaseToUnderscore(final String camelCase) {
Preconditions.checkNotNull(camelCase, "camelCase");
final String[] camelCaseParts = org.apache.commons.lang.StringUtils.splitByCharacterTypeCamelCase(camelCase);
for (int i = 0; i < camelCaseParts.length; i++) {
camelCaseParts[i] = camelCaseParts[i].toLowerCase(Locale.ENGLISH);
}
return org.apache.commons.lang.StringUtils.join(camelCaseParts, "_");
}
}