返回给定属性名称的getter方法名称。
//package com.nowjava;/*nowjava - 时 代 Java 提供*/ public class Main { /** * Return the getter method name for the given property name. * * @param property the property name * @return the getter method name for the given property name. */ public static String toGetterName(String property) { StringBuilder buffer = new StringBuilder(property.length() + 3); buffer.append("get"); buffer.append(Character.toUpperCase(property.charAt(0))); buffer.append(property.substring(1)); return buffer.toString(); } }