String propertyString = property.getStringValue().trim();
for (int j = 0; j < propertyDescriptors.length; j++) {
PropertyDescriptor propertyDescriptor = propertyDescriptors[j];
if (propertyName.equals(propertyDescriptor.getName())) {
String type = propertyDescriptor.getPropertyType().getName();
PropertyEditor propertyEditor = null;
try {
propertyEditor = PropertyEditors.findEditor(type, cl);
} catch (ClassNotFoundException e) {
throw new DeploymentException("Could not load editor for type " + type, e);
}
if (propertyEditor == null) {
throw new DeploymentException("Unable to find PropertyEditor for " + type);
}
propertyEditor.setAsText(propertyString);
Object value = propertyEditor.getValue();
Method m = propertyDescriptor.getWriteMethod();
try {
m.invoke(instance, new Object[] {value});
} catch (Exception e) {
throw new DeploymentException("Could not set property value for property named " + propertyName, e);