Java Field Name Get fieldName(String nodeName)

Here you can find the source of fieldName(String nodeName)

Description

field Name

License

Apache License

Declaration

public static String fieldName(String nodeName) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String fieldName(String nodeName) {
        return toJavaIdentifier(nodeName, false);
    }//from   w ww. jav  a 2  s. c o  m

    public static String toJavaIdentifier(String nodeName, boolean boundary) {
        StringBuilder result = new StringBuilder();
        for (char c : nodeName.toCharArray()) {
            if (c == '_') {
                boundary = true;
            } else if (boundary) {
                result.append(c);
                boundary = false;
            } else {
                result.append(Character.toLowerCase(c));
            }
        }
        return result.toString();
    }
}

Related

  1. fieldName(String accessorName)
  2. fieldName(String className, String rawFieldName)
  3. fieldName(String fieldName, String propName)
  4. fieldName(String getsetName)
  5. fieldName(String name)
  6. fieldName(String underScore)
  7. fieldNameFromPropertyName(final String propertyName)
  8. fieldNameMatchesProperty(final String name, final String property)
  9. fieldNameToConstant(String fieldname)