Java Class Field Convert To fieldToPropertyName(String name)

Here you can find the source of fieldToPropertyName(String name)

Description

Best effort basis to convert the given method name to a property name

License

Apache License

Declaration

public static String fieldToPropertyName(String name) 

Method Source Code

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

public class Main {
    /**/*  w w  w  . ja v a  2 s .  c o m*/
     * Best effort basis to convert the given method name to a property name
     */
    public static String fieldToPropertyName(String name) {
        return lowerFirst(name);
    }

    public static String lowerFirst(String name) {
        if (name.length() > 1) {
            name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
        } else if (name.length() == 1) {
            name = Character.toLowerCase(name.charAt(0)) + "";
        }
        return name;
    }
}

Related

  1. fieldToColumnName(String name)
  2. fieldToGetMethod(String fieldName)
  3. fieldToProperty(String field)
  4. fieldToString(String name, Object value)
  5. fieldToValue(byte[] buffer, int offset, int length)