Map in Attributable

Description

Do you think that we could extend the "automagic" for Attributable to also write/read maps?

We have this increasingly in our code. One instance is PrepareForSimImpl#createAndAddVehiclesForEveryNetworkMode, which then calls VehicleUtils#insertVehicleIdIntoAttributes, which finally puts a Map into the Attributes.

This works, but is not written to file.

It seems to me that we could write something like

<attributes>
<attribute name="modeVehicles" class="java.util.Map????"> car="321_car" bike="321_bike" etc.</attribute>
</attributes>

This would use the same specification as XML attributes, i.e. no commas between key=value pairs.

Presumably, this would work first for Map<String,String>, and eventually we might be able to also make it work for Map<String,Number>.

What do you think? We might try to implement this ourselves, but would like to have your input on possible roadblocks that we are overlooking. Thanks a lot.

Environment

None

Assignee

Thibaut Dubernet

Reporter

Kai Nagel

Labels

None

Priority

Major
Configure