Refactor type checks in EntityId formatters

I just realized I can very, very easily split this (hopefully)
very, very simple to understand chunk from my bigger patch
I9bbbe8055d68b274fa6141eecff4a8d9414f89d9.

Please help me move forward and merge this quick. :-)

Change-Id: I242ba0b0c0b6924cb876a07b82f8a9a4976f65b0
Merge "Refactor type checks in EntityId formatters"