|  | 
| 
| Re: [databinding] Globally convert all empty strings to null [message #327809 is a reply to message #327803] | Fri, 02 May 2008 10:14  |  | 
| Eclipse User  |  |  |  |  | Originally posted by: eclipse-news.rizzoweb.com 
 Jason Kusnier wrote:
 > With databinding is there a way to have it default convert all empty
 > strings to null?  I know I can do this with a converter, but I would
 > need to attach it to every binding.  Any help would be greatly appreciated.
 >
 
 You can do it in a custom UpdateValueStrategy by either setting the
 IConverter or overriding createConverter(Object fromType, Object toType)
 You'll still face the problem of getting that UpdateValueStrategy used
 on all your bindings. One way to do that is to funnel all binding
 creation through a single place; another approach is to create a custom
 DataBindingContext and override bindValue() so that it uses your custom
 UpdateValueStrategy as the default (when null is passed in).
 
 There might be another way to globally apply a strategy or converter,
 but these are the options I know about.
 
 Hope this helps,
 Eric
 |  |  |  | 
Powered by 
FUDForum. Page generated in 0.05860 seconds