@Test public void shouldReplaceIDWithIdInConstantName() { assertEquals("DEFAULT_APPL_VER_ID", constantName("DefaultApplVerID")); }
public static String constantName(final String name) { final String replacedName = name.replace("ID", "Id") .replace("GroupCounter", ""); return toUpperCase(replacedName.charAt(0)) + replacedName .substring(1) .chars() .mapToObj((codePoint) -> (isUpperCase(codePoint) ? "_" : "") + (char)toUpperCase(codePoint)) .collect(joining()); }
GenerationUtil { public static String constantName(final String name) { final String replacedName = name.replace("ID", "Id") .replace("GroupCounter", ""); return toUpperCase(replacedName.charAt(0)) + replacedName .substring(1) .chars() .mapToObj((codePoint) -> (isUpperCase(codePoint) ? "_" : "") + (char)toUpperCase(codePoint)) .collect(joining()); } }
GenerationUtil { public static String constantName(final String name) { final String replacedName = name.replace("ID", "Id") .replace("GroupCounter", ""); return toUpperCase(replacedName.charAt(0)) + replacedName .substring(1) .chars() .mapToObj((codePoint) -> (isUpperCase(codePoint) ? "_" : "") + (char)toUpperCase(codePoint)) .collect(joining()); } private  GenerationUtil(); }
GenerationUtil { public static String constantName(final String name) { final String replacedName = name.replace("ID", "Id") .replace("GroupCounter", ""); return toUpperCase(replacedName.charAt(0)) + replacedName .substring(1) .chars() .mapToObj((codePoint) -> (isUpperCase(codePoint) ? "_" : "") + (char)toUpperCase(codePoint)) .collect(joining()); } private  GenerationUtil(); static String fileHeader(final String packageName); static long packMessageType(final String messageType); static String constantName(final String name); static String constructor(final String name, final Var... parameters); static String paramDeclaration(final Var[] parameters); static String importFor(final Class<?> cls); static String importFor(final String className); static String importStaticFor(final Class<?> cls); static String importStaticFor(final Class<?> cls, final String name); static String importStaticFor(final String cls, final String name); static String optionalStaticInit(final String containing); }
GenerationUtil { public static String constantName(final String name) { final String replacedName = name.replace("ID", "Id") .replace("GroupCounter", ""); return toUpperCase(replacedName.charAt(0)) + replacedName .substring(1) .chars() .mapToObj((codePoint) -> (isUpperCase(codePoint) ? "_" : "") + (char)toUpperCase(codePoint)) .collect(joining()); } private  GenerationUtil(); static String fileHeader(final String packageName); static long packMessageType(final String messageType); static String constantName(final String name); static String constructor(final String name, final Var... parameters); static String paramDeclaration(final Var[] parameters); static String importFor(final Class<?> cls); static String importFor(final String className); static String importStaticFor(final Class<?> cls); static String importStaticFor(final Class<?> cls, final String name); static String importStaticFor(final String cls, final String name); static String optionalStaticInit(final String containing); static final String INDENT; }