readValue
Reads a value from a map and converts it to the specified type.
Return
The value converted to the specified type.
Parameters
T
The type to which the value should be converted.
key
The key whose value is to be read from the map.
Throws
if the key is not set in the map.
if the value cannot be converted to the specified type.