|
From: Rod J. <rod...@in...> - 2004-04-27 15:16:11
|
I think we should support this--I had somewhere last week = where I could have used it (although it was easy enough to = use another approach). = I prefer Colin's syntax approach, although I think it can = still be refined (not that I can think of how to do so off = the top of my head). ---- Original message ---- >Date: Tue, 27 Apr 2= 004 09:58:40 -0400 >From: Colin Sampaleanu <col...@ex...> = >Subject: Re: [Springframework-developer] non-String keys for = map entries = >To: spr...@li... > >I agree it wou= ld be very good to have. I've been hit a few = times by the = >lack. > >I am ok with your syntax, given that probably most of the = uses will = >still be the simple case. An alternative would be to have = another kind = >of entry allowed > ><map> > <complexentry> > <key> > <ref= bean=3D"myKey"/> > </key> > <value> > <ref bean=3D"myTarg= et"/> > </value> > </complexentry> ></map> > >'complexentry' is= just a name I came up with now. I don't = really like it = >or think it that suitable... > >Colin > > >j=FCrgen h=F6ller [werk= 3AT] wrote: > >>A colleague of mine just suggested that <entry> tags i= n XML = bean definitions should also support non-String keys: After = all, a java.util.Map can take any Object as key. >> >>So instead of ju= st the current: >> >><map> >> <entry key=3D"myKey"> >> <ref bean= =3D"myTarget"/> >> </entry> >></map> >> >>We could also support som= ething like the following: >> >><map> >> <entry> >> <key> >> = <ref bean=3D"myKey"/> >> </key> >> <ref bean=3D"myTarget"/> = >> </entry> >></map> >> >>The problem is the syntax: It looks odd to= have the <ref> = Map value at the same level as the <key> subtag, with the = latter having a nested <ref> again... >> >>Any ideas? >> >>Juergen = >> >> >>DI J=FCrgen H=F6ller >>Senior System Architect >>___________= ___________________________ >> >>werk3ATS - division systementwicklung= >>werk3AT informations- und mediensysteme >> >>europaplatz 4 >>A - = 4020 linz >> >>t. +43 (0) 732 71 65 29 502 >>f. +43 (0) 732 71 65 2= 9 3 >>mailto:jue...@we... >>http://www.werk3at.com >>_= _____________________________________ >>werk3ATS - WIR ENTWICKELN ERFOL= G >> >> >>------------------------------------------------------- >>= This SF.net email is sponsored by: The Robotic Monkeys at = ThinkGeek >>For a limited time only, get FREE Ground shipping on all = orders of $35 >>or more. Hurry up and shop folks, this offer expires Ap= ril = 30th! >>http://www.thinkgeek.com/freeshipping/?cpg=12297 >>___________= ____________________________________ >>Springframework-developer mailin= g list >>Spr...@li... >>https://lis= ts.sourceforge.net/lists/listinfo/springframework -developer >> = >> > > > >------------------------------------------------------- >= This SF.net email is sponsored by: The Robotic Monkeys at = ThinkGeek >For a limited time only, get FREE Ground shipping on all = orders of $35 >or more. Hurry up and shop folks, this offer expires Apr= il = 30th! >http://www.thinkgeek.com/freeshipping/?cpg=12297 >_____________= __________________________________ >Springframework-developer mailing l= ist >Spr...@li... >https://lists.so= urceforge.net/lists/listinfo/springframework- developer |
|
From: Alef A. <al...@jt...> - 2004-06-02 12:09:32
|
Have we reached a conclusion on this one? There is a question on the = forum about non-String keys in maps. Alef -----Original Message----- From: spr...@li... = [mailto:spr...@li...] On Behalf = Of Colin Sampaleanu Sent: Wednesday, April 28, 2004 5:07 AM To: spr...@li... Subject: Re: [Springframework-developer] non-String keys for map entries btw Thomas, a few people have suggested a variation of your first choice = below. However, while that covers having a key that's a bean reference,=20 it doesn't cover the case where it's defined inline (as a value or other = type)... tho...@tr... wrote: >I too think this would be valuable. > >I'd like to keep it simple. The following seems to me the most = consistent with >the current syntax and with the Map interface itself: > ><map> > <entry keyref=3D"myBean"> > <ref bean=3D"myTarget"/> > </entry> ></map> > >or=20 > ><map> > <entry> > <key> > <ref bean=3D"myKeyBean"/> > </key> > <value> > <ref bean=3D"myTargetBean"/> > </value> > </entry> ></map> > >This should also be valid, but I would not recommend using it: > ><map> > <entry> > <key> > <ref bean=3D"myKeyBean"/> > </key> > <ref bean=3D"myTargetBean"/> > </entry> ></map> > > >Thomas > > > >Quoting Colin Sampaleanu <col...@ex...>: > > =20 > >>I agree it would be very good to have. I've been hit a few times by = the=20 >>lack. >> >>I am ok with your syntax, given that probably most of the uses will=20 >>still be the simple case. An alternative would be to have another kind = >>of entry allowed >> >><map> >> <complexentry> >> <key> >> <ref bean=3D"myKey"/> >> </key> >> <value> >> <ref bean=3D"myTarget"/> >> </value> >> </complexentry> >></map> >> >>'complexentry' is just a name I came up with now. I don't really like = it=20 >>or think it that suitable... >> >>Colin >> >> >>j=FCrgen h=F6ller [werk3AT] wrote: >> >> =20 >> >>>A colleague of mine just suggested that <entry> tags in XML bean = definitions >>> =20 >>> >>should also support non-String keys: After all, a java.util.Map can = take any >>Object as key. >> =20 >> >>>So instead of just the current: >>> >>><map> >>> <entry key=3D"myKey"> >>> <ref bean=3D"myTarget"/> >>> </entry> >>></map> >>> >>>We could also support something like the following: >>> >>><map> >>> <entry> >>> <key> >>> <ref bean=3D"myKey"/> >>> </key> >>> <ref bean=3D"myTarget"/> >>> </entry> >>></map> >>> >>>The problem is the syntax: It looks odd to have the <ref> Map value = at the >>> =20 >>> >>same level as the <key> subtag, with the latter having a nested <ref> >>again... >> =20 >> >>>Any ideas? >>> >>>Juergen >>> =20 >>> ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. = Take an Oracle 10g class now, and we'll give you the exam FREE.=20 http://ads.osdn.com/?ad_id=3D3149&alloc_id=3D8166&op=3Dclick _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |
|
From: Andy D. <an...@ma...> - 2004-06-02 16:17:18
|
I think I'm seeing a bug in Spring, but thought I'd bounce it off others
first. I have a class with multiple constructors, two of which are defined
as follows:
public DefaultType(Type superType, String qualifiedName)
and:
public DefaultType(Type superType, String uri, String name)
I use the following XML to configure:
<bean
id="personType"
class="com.marathon.util.sdo.DefaultType">
<constructor-arg><ref bean="entityType"/></constructor-arg>
<constructor-arg><value>m:Person</value></constructor-arg>
<property name="typeProperties">
<list>
...
</list>
</property>
</bean>
Spring will call the second constructor instead of the first, passing in
"m:Person" to both String parameters, equivalent to this:
new DefaultType(entityType, "m:Person", "m:Person")
Am I doing something wrong, or is this a bug? This is with Spring 1.0.1
(release)
|