commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jared Graber" <jgra...@zedak.com>
Subject RE: [commons beanutil] - null, LongConverter, where (or when) should a new converted be registered?
Date Thu, 24 Aug 2006 15:02:24 GMT
You need to register your converter at some point before the setProperty is
called.  You only need to call it once as it will stay registered unless you
deregister it.  Note that this will affect ALL conversions to Long while it
is registered.  

Someone correct me if I'm wrong, but I don't believe it is thread-safe
(though it is classloader safe) so you have to be careful with registering
and deregistering converters.

I have only used converters for use with Digester in a web application so I
registered the converters in a servlet context listener.

-Jared

-----Original Message-----
From: German Sibay [mailto:gsibay@hexacta.com] 
Sent: Thursday, August 24, 2006 10: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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


---------------------------------------------------------------------
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