in src/main/java/org/apache/commons/beanutils2/MappedPropertyDescriptor.java [272:311]
public MappedPropertyDescriptor(final String propertyName, final Class<?> beanClass) throws IntrospectionException {
super(propertyName, null, null);
if (propertyName == null || propertyName.isEmpty()) {
throw new IntrospectionException("bad property name: " + propertyName + " on class: " + beanClass.getClass().getName());
}
setName(propertyName);
final String base = capitalizePropertyName(propertyName);
// Look for mapped read method and matching write method
Method mappedReadMethod = null;
Method mappedWriteMethod = null;
try {
try {
mappedReadMethod = getMethod(beanClass, "get" + base, STRING_CLASS_PARAMETER);
} catch (final IntrospectionException e) {
mappedReadMethod = getMethod(beanClass, "is" + base, STRING_CLASS_PARAMETER);
}
final Class<?>[] params = { String.class, mappedReadMethod.getReturnType() };
mappedWriteMethod = getMethod(beanClass, "set" + base, params);
} catch (final IntrospectionException e) {
/*
* Swallow IntrospectionException TODO: Why?
*/
}
// If there's no read method, then look for just a write method
if (mappedReadMethod == null) {
mappedWriteMethod = getMethod(beanClass, "set" + base, 2);
}
if (mappedReadMethod == null && mappedWriteMethod == null) {
throw new IntrospectionException("Property '" + propertyName + "' not found on " + beanClass.getName());
}
mappedReadMethodRef = new MappedMethodReference(mappedReadMethod);
mappedWriteMethodRef = new MappedMethodReference(mappedWriteMethod);
findMappedPropertyType();
}