package rh.intellicareAppServer.dao;
public class test {
String aA;
String aa;
public String getaA() {
return aA;
} public void setaA(String aA) {
this.aA = aA;
} public String getAa() {
return aa;
} public void setAa(String aa) {
this.aa = aa;
}
}
如上所示,java 类的参数在自动生成set和get方法时,遵循规则如下
如果第一位是小写,并且参数长度为一或者参数第二位为大写时,第一位字母大写,代码如下:
StringBuilder sb = new StringBuilder(); sb.append(property);
if (Character.isLowerCase(sb.charAt(0))) {
if (sb.length() == 1 || !Character.isUpperCase(sb.charAt(1))) {
sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
}
}