Class Enums

    • Method Detail

      • getField

        @GwtIncompatible
        public static Field getField​(Enum<?> enumValue)
        Returns the Field in which enumValue is defined. For example, to get the Description annotation on the GOLF constant of enum Sport, use Enums.getField(Sport.GOLF).getAnnotation(Description.class).
        Since:
        12.0
      • stringConverter

        public static <T extends Enum<T>> Converter<String,​T> stringConverter​(Class<T> enumClass)
        Returns a converter that converts between strings and enum values of type enumClass using Enum.valueOf(Class, String) and Enum.name(). The converter will throw an IllegalArgumentException if the argument is not the name of any enum constant in the specified enum.
        Since:
        16.0