Generate a map between array and component types, rather than using big ...

...(and potentially inconsistent) switch blocks