@Test public void testRemoveGetterAndLowercaseFirstLetter() { assertNull(StringUtil.getFieldNameFromGetter(null)); assertEquals("", StringUtil.getFieldNameFromGetter("")); assertEquals("g", StringUtil.getFieldNameFromGetter("g")); assertEquals("ge", StringUtil.getFieldNameFromGetter("ge")); assertEquals("get", StringUtil.getFieldNameFromGetter("get")); assertEquals("i", StringUtil.getFieldNameFromGetter("i")); assertEquals("is", StringUtil.getFieldNameFromGetter("is")); assertEquals("abc", StringUtil.getFieldNameFromGetter("getAbc")); assertEquals("abc", StringUtil.getFieldNameFromGetter("isAbc")); }
public static String getFieldNameFromGetter(String getter) { if (StringUtil.isEmpty(getter)) { return getter; } String subGetter; if (getter.startsWith("get")) { if (getter.length() <= "get".length()) { return getter; } subGetter = getter.substring("get".length()); } else if (getter.startsWith("is")) { if (getter.length() <= "is".length()) { return getter; } subGetter = getter.substring("is".length()); } else { return getter; } return String.valueOf(subGetter.charAt(0)).toLowerCase() + subGetter.substring(1); }
StringUtil { public static String getFieldNameFromGetter(String getter) { if (StringUtil.isEmpty(getter)) { return getter; } String subGetter; if (getter.startsWith("get")) { if (getter.length() <= "get".length()) { return getter; } subGetter = getter.substring("get".length()); } else if (getter.startsWith("is")) { if (getter.length() <= "is".length()) { return getter; } subGetter = getter.substring("is".length()); } else { return getter; } return String.valueOf(subGetter.charAt(0)).toLowerCase() + subGetter.substring(1); } }
StringUtil { public static String getFieldNameFromGetter(String getter) { if (StringUtil.isEmpty(getter)) { return getter; } String subGetter; if (getter.startsWith("get")) { if (getter.length() <= "get".length()) { return getter; } subGetter = getter.substring("get".length()); } else if (getter.startsWith("is")) { if (getter.length() <= "is".length()) { return getter; } subGetter = getter.substring("is".length()); } else { return getter; } return String.valueOf(subGetter.charAt(0)).toLowerCase() + subGetter.substring(1); }  }
StringUtil { public static String getFieldNameFromGetter(String getter) { if (StringUtil.isEmpty(getter)) { return getter; } String subGetter; if (getter.startsWith("get")) { if (getter.length() <= "get".length()) { return getter; } subGetter = getter.substring("get".length()); } else if (getter.startsWith("is")) { if (getter.length() <= "is".length()) { return getter; } subGetter = getter.substring("is".length()); } else { return getter; } return String.valueOf(subGetter.charAt(0)).toLowerCase() + subGetter.substring(1); }  static boolean isEmpty(String s); static String capitalizeFirstLetter(String sentence); static String getFieldNameFromGetter(String getter); static String getFieldNameFromSetter(String setter); static String formatTimeHMS(long milliseconds); }
StringUtil { public static String getFieldNameFromGetter(String getter) { if (StringUtil.isEmpty(getter)) { return getter; } String subGetter; if (getter.startsWith("get")) { if (getter.length() <= "get".length()) { return getter; } subGetter = getter.substring("get".length()); } else if (getter.startsWith("is")) { if (getter.length() <= "is".length()) { return getter; } subGetter = getter.substring("is".length()); } else { return getter; } return String.valueOf(subGetter.charAt(0)).toLowerCase() + subGetter.substring(1); }  static boolean isEmpty(String s); static String capitalizeFirstLetter(String sentence); static String getFieldNameFromGetter(String getter); static String getFieldNameFromSetter(String setter); static String formatTimeHMS(long milliseconds);  }