Hygiene: change some if statements to switch statements.

JDK 7 added the ability to do switch statements on Strings. Since we're now
using JDK 7, this patch changes some particularly convoluted if statements
which operate on Strings to use switch statements instead, improving code
readability and probably slightly improving performance.

Change-Id: I36202c34f48b21347fa761e358dc0014ef3e9ca6