i'd suggest retrying that ObjectStringConverter. to convert a string to an object, you need to override the objectToString method. you say that you've trying this (and it doesn't work) but there are a few little wrinkles to do with the type passed in and making sure that it is called (which means getting the mapping right). i'd suggest that you put logging code into the objectToString and observe the values passed in. if the value in the xml that your expect to map to the keystroke is passed in but your type-based conversion is not called then looking at the type passed in should help. if the value in the xml is not passed in, then it's a binding problem. if it's a binding problem the post back with more details of the xml and the beans.
- robert
On 10 Mar 2004, at 19:52, Smith, Pamela wrote:
How do I convert a String to an Object during parsing? I registered the converter in ConvertUtils but betwixt never calls its convert method. I've also tried plugging in a custom ObjectStringConverter to the reader's BindingConfiguration but the stringToObject method is not called for the registered class. Thanks for any help.
Pam
class MyConverter implements Converter { public Object convert(Class aClass, Object o) { if (KeyStroke.class.equals(aClass)) { return KeyStroke.getKeyStroke((String)o); } } }
... ConvertUtils.register(new MyConverter(), KeyStroke.class); BeanReader reader = new BeanReader(); reader.parse ...
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
