Java Field Name Get fieldNameToMethodName(String methodPrefix, String fieldName)

Here you can find the source of fieldNameToMethodName(String methodPrefix, String fieldName)

Description

field name to method name

License

Apache License

Parameter

Parameter Description
methodPrefix a parameter
fieldName a parameter

Return

methodName

Declaration

public static String fieldNameToMethodName(String methodPrefix, String fieldName) 

Method Source Code

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

public class Main {
    /**/*w  w  w.j a  v a  2s .c o  m*/
     * field name to method name
     * 
     * @param methodPrefix
     * @param fieldName
     * @return methodName
     */
    public static String fieldNameToMethodName(String methodPrefix, String fieldName) {
        return fieldNameToMethodName(methodPrefix, fieldName, false);
    }

    /**
     * field name to method name
     * 
     * @param methodPrefix
     * @param fieldName
     * @param ignoreFirstLetterCase
     * @return methodName
     */
    public static String fieldNameToMethodName(String methodPrefix, String fieldName,
            boolean ignoreFirstLetterCase) {
        String methodName = null;
        if (fieldName != null && fieldName.length() > 0) {
            if (ignoreFirstLetterCase) {
                methodName = methodPrefix + fieldName;
            } else {
                methodName = methodPrefix + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
            }
        } else {
            methodName = methodPrefix;
        }
        return methodName;
    }
}

Related

  1. fieldName(String nodeName)
  2. fieldName(String underScore)
  3. fieldNameFromPropertyName(final String propertyName)
  4. fieldNameMatchesProperty(final String name, final String property)
  5. fieldNameToConstant(String fieldname)
  6. fieldNameToPath(String fieldName)