code: public static <E extends Enum<E>> Function<String, E> toEnum(Class<E> enumType) {
      return new Function<String, E>() {
        @Override public E apply(String name) {
          return Enum.valueOf(enumType, name);
        }
        @Override public String toString() {
          return "-> " + enumType.getName();
        }
      };
    }
docs: Returns a {@link Map} that maps the string representation of an enum
  to the corresponding enum value by calling {@link Enum#valueOf(Class, String)}.