if (descriptor != null) {
Method writer = descriptor.getWriteMethod();
if (writer == null) {
throw new IntrospectionException("Unwritable property '"
+ pathSegment
+ "'");
}
// do basic conversions
value = ConverterFactory.factory
.getConverter(descriptor.getPropertyType())
.convert(value, descriptor.getPropertyType());
// set
writer.invoke(object, value);
}
// note that Map has two traditional bean properties - 'empty' and 'class', so
// do a check here only after descriptor lookup failed.
else if (object instanceof Map) {
((Map<Object, Object>) object).put(pathSegment, value);
}
else {
throw new IntrospectionException("No property '"
+ pathSegment
+ "' found in class "
+ object.getClass().getName());
}
}