}
try {
hkp = (HasKeyedProperties) bean;
} catch (ClassCastException cce) {
// targetted bean has no overridable properties
throw new TypeMismatchException(bean,HasKeyedProperties.class,cce);
}
// install knowledge of this path
hkp.getKeyedProperties().addExternalPath(beanPath);
// verify type-compatibility
BeanWrapperImpl wrapper = new BeanWrapperImpl(hkp);
Class<?> requiredType = wrapper.getPropertyType(terminalProp);
try {
// convert for destination type
map.put(fullpath, wrapper.convertForProperty(value,terminalProp));
} catch(TypeMismatchException tme) {
TypeMismatchException tme2 =
new TypeMismatchException(
new PropertyChangeEvent(
hkp,
fullpath,
wrapper.getPropertyValue(terminalProp),
value), requiredType, tme);