@Override protected String doBackward(String s) { return targetFormat.to(sourceFormat, s); }
/** Enum values can override for performance reasons. */ String convert(CaseFormat format, String s) { // deal with camel conversion StringBuilder out = null; int i = 0; int j = -1; while ((j = wordBoundary.indexIn(s, ++j)) != -1) { if (i == 0) { // include some extra space for separators out = new StringBuilder(s.length() + 4 * wordSeparator.length()); out.append(format.normalizeFirstWord(s.substring(i, j))); } else { out.append(format.normalizeWord(s.substring(i, j))); } out.append(format.wordSeparator); i = j + wordSeparator.length(); } return (i == 0) ? format.normalizeFirstWord(s) : out.append(format.normalizeWord(s.substring(i))).toString(); }
private String normalizeFirstWord(String word) { return (this == LOWER_CAMEL) ? Ascii.toLowerCase(word) : normalizeWord(word); }
private String normalizeFirstWord(String word) { return (this == LOWER_CAMEL) ? Ascii.toLowerCase(word) : normalizeWord(word); }
@Override protected String doForward(String s) { return sourceFormat.to(targetFormat, s); }
/** Enum values can override for performance reasons. */ String convert(CaseFormat format, String s) { // deal with camel conversion StringBuilder out = null; int i = 0; int j = -1; while ((j = wordBoundary.indexIn(s, ++j)) != -1) { if (i == 0) { // include some extra space for separators out = new StringBuilder(s.length() + 4 * wordSeparator.length()); out.append(format.normalizeFirstWord(s.substring(i, j))); } else { out.append(format.normalizeWord(s.substring(i, j))); } out.append(format.wordSeparator); i = j + wordSeparator.length(); } return (i == 0) ? format.normalizeFirstWord(s) : out.append(format.normalizeWord(s.substring(i))).toString(); }
private String normalizeFirstWord(String word) { return (this == LOWER_CAMEL) ? Ascii.toLowerCase(word) : normalizeWord(word); }
private static String camelToSnake(String name) { return LOWER_CAMEL.to(LOWER_UNDERSCORE, name); }
/** Enum values can override for performance reasons. */ String convert(CaseFormat format, String s) { // deal with camel conversion StringBuilder out = null; int i = 0; int j = -1; while ((j = wordBoundary.indexIn(s, ++j)) != -1) { if (i == 0) { // include some extra space for separators out = new StringBuilder(s.length() + 4 * wordSeparator.length()); out.append(format.normalizeFirstWord(s.substring(i, j))); } else { out.append(format.normalizeWord(s.substring(i, j))); } out.append(format.wordSeparator); i = j + wordSeparator.length(); } return (i == 0) ? format.normalizeFirstWord(s) : out.append(format.normalizeWord(s.substring(i))).toString(); }
@Override protected String doForward(String s) { return sourceFormat.to(targetFormat, s); }
private String getContextClassName(final String context) { return CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, context + "Context"); }
@Override protected String doBackward(String s) { return targetFormat.to(sourceFormat, s); }
@Override protected String doForward(String s) { return sourceFormat.to(targetFormat, s); }
@Override protected String doBackward(String s) { return targetFormat.to(sourceFormat, s); }
/** * Converts name to CamelCase * * @param name name to convert * @return converted name to CamelCase */ public static String toCamelCase(String name) { return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name); } }
private static Iterable<String> splitCamelCase(String name) { return SPLITTER_UNDERSCORE.split( CaseFormat.LOWER_CAMEL.to( CaseFormat.LOWER_UNDERSCORE, name)); }
private static String joinCamelCase(Iterable<String> parts) { return CaseFormat.LOWER_UNDERSCORE.to( CaseFormat.LOWER_CAMEL, JOINER_UNDERSCORE.join(parts)); }
public static String generateAggregationName(String baseName, TypeSignature outputType, List<TypeSignature> inputTypes) { StringBuilder sb = new StringBuilder(); sb.append(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, outputType.toString())); for (TypeSignature inputType : inputTypes) { sb.append(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, inputType.toString())); } sb.append(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, baseName.toLowerCase(ENGLISH))); return sb.toString(); }
private Method findGetterMethod(final DataSource dataSource, final String propertyName) throws NoSuchMethodException { String getterMethodName = Joiner.on("").join("get", CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, propertyName)); Method method = dataSource.getClass().getMethod(getterMethodName); method.setAccessible(true); return method; } }