throws IntrospectionException {
super(propertyName, null, null);
if (propertyName == null || propertyName.length() == 0) {
throw new IntrospectionException("bad property name: " +
propertyName + " on class: " + beanClass.getClass().getName());
}
setName(propertyName);
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 (IntrospectionException e) {
mappedReadMethod = getMethod(beanClass, "is" + base,
STRING_CLASS_PARAMETER);
}
Class[] params = { String.class, mappedReadMethod.getReturnType() };
mappedWriteMethod = getMethod(beanClass, "set" + base, params);
} catch (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);