|
From: Les A. H. <le...@ha...> - 2004-04-27 23:23:21
|
I think the following two are the best candidates:
<map>
<entry>
<key bean=3D"myBean"/> <!-- or <key local=3D"myBean"/> -->
<value bean=3D"myTarget"/> <!-- or <value local=3D"myTarget"/> -->
</entry>
</map>
or (verbose version of above):
<map>
<entry>
<key><ref bean=3D"myBean"/></key>
<value><ref bean=3D"myTarget"/></value>
</entry>
</map>
I really like the first version, and I think it is the most readable. I don=
't
know if it would break backwards compatibility though. Whatever the decisio=
n I
think the most important factor (logically) is that the key and value elemen=
ts
remain xml peers to accurately reflect the Object structure.
So, the following (IMO) would not be a good candidate as it isn't readable a=
s
the first two and doesn't visually reflect the actual object structure of
Map.Entry :
<map>
<entry key=3D"myKey">
<ref bean=3D"myTarget"/>
</entry>
</map>
Les
Quoting tho...@tr...:
> 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
>
> <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...>:
>
> > 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=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
> > or think it that suitable...
> >
> > Colin
> >
> >
> > j=C3=BCrgen h=C3=B6ller [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=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
> > same level as the <key> subtag, with the latter having a nested <ref>
> > again...
> > >
> > >Any ideas?
> > >
> > >Juergen
> > >
> > >
> > >DI J=C3=BCrgen H=C3=B6ller
> > >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 29 3
> > >mailto:jue...@we...
> > >http://www.werk3at.com
> > >______________________________________
> > >werk3ATS - WIR ENTWICKELN ERFOLG
> > >
> > >
> > >-------------------------------------------------------
> > >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 April 30th!
> > >http://www.thinkgeek.com/freeshipping/?cpg=12297
> > >_______________________________________________
> > >Springframework-developer mailing list
> > >Spr...@li...
> > >https://lists.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 April 30th!
> > http://www.thinkgeek.com/freeshipping/?cpg=12297
> > _______________________________________________
> > Springframework-developer mailing list
> > Spr...@li...
> > https://lists.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 April 30th!
> http://www.thinkgeek.com/freeshipping/?cpg=3D12297
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
|