propertyName = Introspector.decapitalize(methodName
.substring(3));
else
propertyName = Introspector.decapitalize(methodName
.substring(2));
BeanProperty property = getBeanProperty(propertyMap, cls,
propertyName, returnType);
property.setGetterMethod(methods[i]);
} else if (methodName.startsWith("set") && parameters.length == 1
&& returnType.equals(void.class)) {
propertyName = Introspector.decapitalize(methodName.substring(3));
BeanProperty property = getBeanProperty(propertyMap, cls,
propertyName, parameters[0]);
property.setSetterMethod(methods[i]);
}
}
// retain only those that can be both read and written and
// sort them by name
List<BeanProperty> serializableProperties = Lists.newArrayList();
for (BeanProperty property : propertyMap.values()) {
if (property.isReadable() || property.isWritable()) {
serializableProperties.add(property);
}
}
Collections
.sort(serializableProperties, new BeanPropertyComparator());
// build the maps and return
final Map<String, BeanProperty> keyedByFieldName = new OrderRetainingMap();
for (BeanProperty property : serializableProperties) {
keyedByFieldName.put(property.getName(), property);
}
keyedByPropertyNameCache.put(clsName, keyedByFieldName);
}
}