Collection<String> (@NotNull String name) { name = StringUtil.decapitalize(deleteNonLetterFromString(StringUtil.unquoteString(name.replace('.', '_')))); if (name.startsWith("get")) { name = name.substring(3); } else name = StringUtil.trimStart(name, "is"); while (name.startsWith("_")) { name = name.substring(1); } final int length = name.length(); final Collection<String> possibleNames = new LinkedHashSet<>(); for (int i = 0; i < length; i++) { if (Character.isLetter(name.charAt(i)) && (i == 0 || name.charAt(i - 1) == '_' || (Character.isLowerCase(name.charAt(i - 1)) && Character.isUpperCase(name.charAt(i))))) { final String candidate = StringUtil.decapitalize(toUnderscoreCase(name.substring(i))); if (candidate.length() < 25) { possibleNames.add(candidate); } } } // prefer shorter names ArrayList<String> reversed = new ArrayList<>(possibleNames); Collections.reverse(reversed); return reversed; }