|
From: Colin S. <col...@ex...> - 2004-04-28 03:03:44
|
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, 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="myBean"> > <ref bean="myTarget"/> > </entry> ></map> > >or > ><map> > <entry> > <key> > <ref bean="myKeyBean"/> > </key> > <value> > <ref bean="myTargetBean"/> > </value> > </entry> ></map> > >This should also be valid, but I would not recommend using it: > ><map> > <entry> > <key> > <ref bean="myKeyBean"/> > </key> > <ref bean="myTargetBean"/> > </entry> ></map> > > >Thomas > > > >Quoting Colin Sampaleanu <col...@ex...>: > > > >>I agree it would 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="myKey"/> >> </key> >> <value> >> <ref bean="myTarget"/> >> </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ürgen höller [werk3AT] wrote: >> >> >> >>>A colleague of mine just suggested that <entry> tags in XML bean definitions >>> >>> >>should also support non-String keys: After all, a java.util.Map can take any >>Object as key. >> >> >>>So instead of just the current: >>> >>><map> >>> <entry key="myKey"> >>> <ref bean="myTarget"/> >>> </entry> >>></map> >>> >>>We could also support something like the following: >>> >>><map> >>> <entry> >>> <key> >>> <ref bean="myKey"/> >>> </key> >>> <ref bean="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 >>> >>> |