* @return the property name defined by the method according to JavaBeans
* convention, or null if the method does not define a JavaBeans
* property setter/getter.
*/
static String propertyNameOfMethod(Element el) {
Name methodName = el.getSimpleName();
String propertyName = null;
if (methodName.length() > 3 && "get".contentEquals(methodName.subSequence(0, 3))) {
StringBuilder sb = new StringBuilder(methodName.length() - 3);
sb.append(Character.toLowerCase(methodName.charAt(3)));
sb.append(methodName.subSequence(4, methodName.length()));
propertyName = sb.toString();
}
else if (methodName.length() > 2 && "is".contentEquals(methodName.subSequence(0, 2))) {
StringBuilder sb = new StringBuilder(methodName.length() - 2);
sb.append(Character.toLowerCase(methodName.charAt(2)));
sb.append(methodName.subSequence(3, methodName.length()));
propertyName = sb.toString();
}
else if (methodName.length() > 3 && "set".contentEquals(methodName.subSequence(0, 2))) {
StringBuilder sb = new StringBuilder(methodName.length() - 3);
sb.append(Character.toLowerCase(methodName.charAt(3)));
sb.append(methodName.subSequence(4, methodName.length()));
propertyName = sb.toString();
}
return propertyName;
}