返回给定属性名称的设置方法名称。
/** 来 自 时代Java公众号 - nowjava.com **/ //package com.nowjava; public class Main { /** * Return the setter method name for the given property name. * * @param property the property name * @return the setter method name for the given property name. */ public static String toSetterName(String property) { StringBuilder buffer = new StringBuilder(property.length() + 3); buffer.append("set"); buffer.append(Character.toUpperCase(property.charAt(0))); buffer.append(property.substring(1)); return buffer.toString(); } }