in src/main/java/org/apache/commons/beanutils2/locale/LocaleBeanUtilsBean.java [203:233]
protected Class<?> definePropertyType(final Object target, final String name, final String propName)
throws IllegalAccessException, InvocationTargetException {
Class<?> type = null; // Java type of target property
if (target instanceof DynaBean) {
final DynaClass dynaClass = ((DynaBean) target).getDynaClass();
final DynaProperty dynaProperty = dynaClass.getDynaProperty(propName);
if (dynaProperty == null) {
return null; // Skip this property setter
}
type = dynaProperty.getType();
} else {
PropertyDescriptor descriptor = null;
try {
descriptor = getPropertyUtils().getPropertyDescriptor(target, name);
if (descriptor == null) {
return null; // Skip this property setter
}
} catch (final NoSuchMethodException e) {
return null; // Skip this property setter
}
if (descriptor instanceof MappedPropertyDescriptor) {
type = ((MappedPropertyDescriptor) descriptor).getMappedPropertyType();
} else if (descriptor instanceof IndexedPropertyDescriptor) {
type = ((IndexedPropertyDescriptor) descriptor).getIndexedPropertyType();
} else {
type = descriptor.getPropertyType();
}
}
return type;
}