What about using Enum.valueOf(TimeUnit.class, name) instead?