commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Smith, Pamela" <Pamela.Sm...@sabre.com>
Subject Betwixt - Converting Strings to Objects
Date Wed, 10 Mar 2004 19:52:55 GMT
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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message