|
From: Colin S. <col...@ex...> - 2005-03-27 22:20:23
|
I'm trying to say it can't even be done. If you are trying to set an Object type (which is the value part of a key/value pair, for example), then '3000L' is a perfectly valid String. Short of Spring being given a hint as with the 'type' attribute, it would be erronous to just assume that anything which looks like that is a Long... Colin Rob Harrop wrote: >Actually, I'm not too sure that we can get it to work using the >PropertyEditor mechanism - it would definitely need additional support in >the core itself. > >The 'type' attribute approach works well, but it can get quite verbose if >you have to enter a bunch of values that need to be non-standard types. > >Rob > >-----Original Message----- >From: spr...@li... >[mailto:spr...@li...] On Behalf Of >Colin Sampaleanu >Sent: 27 March 2005 15:31 >To: spr...@li... >Subject: Re: [Springframework-developer] Number Types in Configuration > >Rob Harrop wrote: > > > >>Just seen this post on the forum: >>http://forum.springframework.org/viewtopic.php?t=4350 and I think it >>would be a really good idea if you could use Java language semantics >>for numbers inside the configuration file. So, for example, you can >>specify 3000L and have it be a Long rather than an Integer. This is >>much simpler than the current solution. >> >> > >Rob, > >How is this really supposed to work in terms of implementation though? >Keep in mind right now the values are Strings, and then a PropertyEditor >takes care of converting to the target type (when directly setting a >property). How is Spring supposed to know that this is going to be a >target Long, as opposed to just a string, given that what is being set >is of type Object? > >On the other hand, the value element does have a 'type' attribute, so >this can be specified for this case: > <value type="java.lang.Long">30000</value> > >Colin > > |