|
From: <jue...@we...> - 2004-04-27 09:22:32
|
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=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 29 3
mailto:jue...@we...
http://www.werk3at.com
______________________________________
werk3ATS - WIR ENTWICKELN ERFOLG
|
|
From: Darren D. <da...@da...> - 2004-04-27 09:49:06
|
=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Tuesday 27 April 2004 10:21, j=FCrgen h=F6ller [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?
<map>
<!-- as now: String key -->
<entry key=3D"myKey">
<ref bean=3D"myTarget"/>
</entry>
</map>
1. consistent DTD
<map>
<!-- kludgy..? symbolised bean reference -->
<entry key=3D"@myBean">
<ref bean=3D"myTarget"/>
</entry>
</map>
2. add ref to DTD attr list for map/entry
<map>
<entry ref=3D"myBean">
<ref bean=3D"myTarget"/>
</entry>
</map>
Both suffer from losing the ability to declare 'local' or 'bean' but that=20
might not matter since neither may be capable of being validated via DTD=20
anyway - I'm no DTD expert.
Both are backward compatible though - if we go with <key> as an element=20
rather than an attribute, existing context definitions will break won't=20
they (unless the String version remains as an attribute which would be=20
somewhat confusing I think)
I wonder though what the use case would be. I think using objects other=20
than strings as map keys is a common requirement in application code, but=20
in setting up a context? I'm not sure - did your colleague have a=20
particular scenario in mind that could better be handled with such a=20
change, or was it a discussion item? It'd be interesting to know!
=2D --=20
Darren Davison
Public Key: http://www.davison.uk.net/key.jsp
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFAjiyJKLMLAN01aw0RAp1ZAJ47umxiqboVg9lju9Dnn/Tznv8F4QCeKBCP
oHLwMJQ52Xe8pDxeWFeg+cI=3D
=3Ds02n
=2D----END PGP SIGNATURE-----
|
|
From: Alef A. <al...@jt...> - 2004-04-27 10:21:00
|
> 2. add ref to DTD attr list for map/entry > <map> > <entry ref="myBean"> > <ref bean="myTarget"/> > </entry> > </map> > > Both suffer from losing the ability to declare 'local' or 'bean' but that > might not matter since neither may be capable of being validated via DTD > anyway - I'm no DTD expert. I like this one, but for consistency purposes, I'd add the local and bean anyway, even if no DTD checking is possible (but it IS as far as I know). So: <map> <entry bean="myBean"> <ref bean="bla"/> </entry> <entry local="myBean"> <ref bean="bla"/> </entry> </map> Alef |
|
From: Colin S. <col...@ex...> - 2004-04-27 13:58:47
|
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=20
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:
>A colleague of mine just suggested that <entry> tags in XML bean definit=
ions 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 t=
he 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 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
> =20
>
|
|
From: <tho...@tr...> - 2004-04-27 14:50:48
|
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
> >
> >
> >DI Jürgen Höller
> >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/?cpg297
> >_______________________________________________
> >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/?cpg297
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
|
|
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
>
|
|
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 >>> >>> |
|
From: James C. <jim...@do...> - 2004-04-27 16:37:48
|
I too like Colin's proposed syntax. It would be slightly more in line = with the Java Map to change <complexentry> to <mapentry>. > -----Original Message----- > From: spr...@li... > [mailto:spr...@li...] On = Behalf > Of Colin Sampaleanu > Sent: Tuesday, April 27, 2004 9:59 AM > To: spr...@li... > Subject: Re: [Springframework-developer] non-String keys for map = entries >=20 > I agree it would be very good to have. I've been hit a few times by = the > lack. >=20 > 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 >=20 > <map> > <complexentry> > <key> > <ref bean=3D"myKey"/> > </key> > <value> > <ref bean=3D"myTarget"/> > </value> > </complexentry> > </map> >=20 > 'complexentry' is just a name I came up with now. I don't really like = it > or think it that suitable... >=20 > Colin >=20 >=20 > j=FCrgen h=F6ller [werk3AT] wrote: >=20 > >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=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 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 > > > > >=20 >=20 >=20 > ------------------------------------------------------- > 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 |