Here you can find the source of toJavaBeanPropertyName(String prop)
Parameter | Description |
---|---|
prop | the property name. |
public static String toJavaBeanPropertyName(String prop)
//package com.java2s; /*/* www. j a v a 2 s . c om*/ * Copyright (c) 2005-2016 Vincent Vandenschrick. All rights reserved. * * This file is part of the Jspresso framework. * * Jspresso is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Jspresso is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with Jspresso. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Whenever a property name starts with a single lowercase letter, the actual * java bean property starts with an upper case letter. * * @param prop * the property name. * @return the fixed java bean property name. */ public static String toJavaBeanPropertyName(String prop) { if (prop != null && prop.length() >= 2) { if (Character.isLowerCase(prop.charAt(0)) && Character.isUpperCase(prop.charAt(1))) { StringBuilder fixedProp = new StringBuilder(prop.substring(0, 1).toUpperCase()); fixedProp.append(prop.substring(1)); return fixedProp.toString(); } } return prop; } }