struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher Cheng" <christop...@netdimensions.com>
Subject Why is PropertyEditor conversion not added in PropertyUtils.setSimpleProperty?
Date Wed, 02 Jan 2002 08:39:59 GMT
How come PropertyUtils.setSimpleProperty (…) doesn’t have a PropertyEditor
built in?

It would be nice to have something like this.


public static void setSimpleProperty(Object bean, String name, Object value)
throws IllegalAccessException, InvocationTargetException,
NoSuchMethodException {

    …..,,, codes …..

    PropertyEditor editor =
PropertyEditorManager.findEditor(descriptor.getPropertyType());
    try {
        if (editor != null) {
            editor.setValue(values[0]);
            values[0] = editor.getValue();
        }
    }
    catch (Exception e) {
        e.printStackTrace(System.out);
    }

writeMethod.invoke(bean, values);
}





Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message