|
From: Peter B. <pet...@ho...> - 2005-10-19 09:37:09
|
Hello.
Would it make sense to add key-class and value-class attributes to the
<map> element, and feed the strings in the key/value elements (or
attributes) to the appropriate PropertyEditor, to allow setting key and
value of the correct class when using maps with generics?
For example, consider this example:
public Map<Locale, String> getHeadsOfState() { ... }
configured like this:
<property name="headsOfState">
<map key-class="java.util.Locale" value-class="java.lang.String">
<entry key="en_US" value="George W. Bush"/>
<entry key="en_GB" value="Tony Blair"/>
<entry key="sv_SE" value="Göran Persson"/>
</map>
</property>
I've glanced at modifying the xml parsing and subclassing or modifying
MapFactoryBean, but I thought I'd ask here first if it's possible to do
this any other way, or if it's a bad idea altogether.
What do you think?
/Peter Backlund
|