You don't have to write your own. The LongConverter has a constructor that you
can pass in a default value. If you register an instance of the LongConverter
created using this constructor with a null value, it will give you null instead
of 0. You can put the following code somewhere in your application context, or
servlet, or just as you said in the constructor of a singleton of your app.
BeanUtils.register(new LongConverter(null),Long.class);
-----Original Message-----
From: German Sibay [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 24, 2006 8:51 AM
To: Jakarta Commons Users List
Subject: [commons beanutil] - null, LongConverter, where (or when) should a new
converted be registered?
Hi
While working with BeanUtils I found that the default LongConverter converts a
null to a Long 0. I needed a null so I wrote my own Converter.
The question is where should I put it?
I don´t really know where is that the converters are initialized the first time.
Must I register this converter every time before using BeanUtils.setProperty?
Is Ok if I access beanUtils through a singleton created by my witch registers
the converter in the constructor?
Where in my application should I register my converter?
Thanks!
Germán Sibay.
---------------------------------------------------------------------
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]