@Test public void toMemberName() { JavaName name = JavaName.of("OneTwoThreeFour"); assertThat(name.toMemberName(), is("oneTwoThreeFour")); }
public String toMemberName() { if (words.isEmpty()) { return EMPTY_NAME; } StringBuilder buf = new StringBuilder(); buf.append(words.get(0)); for (int i = 1, n = words.size(); i < n; i++) { buf.append(capitalize(words.get(i))); } String result = buf.toString(); if (RESERVED.contains(result) || Character.isJavaIdentifierStart(result.charAt(0)) == false) { return escape(result); } return result; }
JavaName { public String toMemberName() { if (words.isEmpty()) { return EMPTY_NAME; } StringBuilder buf = new StringBuilder(); buf.append(words.get(0)); for (int i = 1, n = words.size(); i < n; i++) { buf.append(capitalize(words.get(i))); } String result = buf.toString(); if (RESERVED.contains(result) || Character.isJavaIdentifierStart(result.charAt(0)) == false) { return escape(result); } return result; } }
JavaName { public String toMemberName() { if (words.isEmpty()) { return EMPTY_NAME; } StringBuilder buf = new StringBuilder(); buf.append(words.get(0)); for (int i = 1, n = words.size(); i < n; i++) { buf.append(capitalize(words.get(i))); } String result = buf.toString(); if (RESERVED.contains(result) || Character.isJavaIdentifierStart(result.charAt(0)) == false) { return escape(result); } return result; } JavaName(List<String> words); }
JavaName { public String toMemberName() { if (words.isEmpty()) { return EMPTY_NAME; } StringBuilder buf = new StringBuilder(); buf.append(words.get(0)); for (int i = 1, n = words.size(); i < n; i++) { buf.append(capitalize(words.get(i))); } String result = buf.toString(); if (RESERVED.contains(result) || Character.isJavaIdentifierStart(result.charAt(0)) == false) { return escape(result); } return result; } JavaName(List<String> words); static JavaName of(String nameString); List<String> getSegments(); String toTypeName(); String toMemberName(); String toConstantName(); String toSnakeName(); void addFirst(String segment); void removeFirst(); void addLast(String segment); void removeLast(); }
JavaName { public String toMemberName() { if (words.isEmpty()) { return EMPTY_NAME; } StringBuilder buf = new StringBuilder(); buf.append(words.get(0)); for (int i = 1, n = words.size(); i < n; i++) { buf.append(capitalize(words.get(i))); } String result = buf.toString(); if (RESERVED.contains(result) || Character.isJavaIdentifierStart(result.charAt(0)) == false) { return escape(result); } return result; } JavaName(List<String> words); static JavaName of(String nameString); List<String> getSegments(); String toTypeName(); String toMemberName(); String toConstantName(); String toSnakeName(); void addFirst(String segment); void removeFirst(); void addLast(String segment); void removeLast();  }