Class Enums.StringConverter<T extends Enum<T>>

java.lang.Object
com.google.common.base.Converter<String,T>
com.google.common.base.Enums.StringConverter<T>
All Implemented Interfaces:
Function<String,T>, Serializable, Function<String,T>
Enclosing class:
Enums

private static final class Enums.StringConverter<T extends Enum<T>> extends Converter<String,T> implements Serializable
  • Field Details

  • Constructor Details

    • StringConverter

      StringConverter(Class<T> enumClass)
  • Method Details

    • doForward

      protected T doForward(String value)
      Description copied from class: Converter
      Returns a representation of a as an instance of type B. If a cannot be converted, an unchecked exception (such as IllegalArgumentException) should be thrown.
      Specified by:
      doForward in class Converter<String,T extends Enum<T>>
      Parameters:
      value - the instance to convert; will never be null
      Returns:
      the converted instance; must not be null
    • doBackward

      protected String doBackward(T enumValue)
      Description copied from class: Converter
      Returns a representation of b as an instance of type A. If b cannot be converted, an unchecked exception (such as IllegalArgumentException) should be thrown.
      Specified by:
      doBackward in class Converter<String,T extends Enum<T>>
      Parameters:
      enumValue - the instance to convert; will never be null
      Returns:
      the converted instance; must not be null
    • equals

      public boolean equals(@CheckForNull Object object)
      Description copied from class: Converter
      Indicates whether another object is equal to this converter.

      Most implementations will have no reason to override the behavior of Object.equals(java.lang.Object). However, an implementation may also choose to return true whenever object is a Converter that it considers interchangeable with this one. "Interchangeable" typically means that Objects.equal(this.convert(a), that.convert(a)) is true for all a of type A (and similarly for reverse). Note that a false result from this method does not imply that the converters are known not to be interchangeable.

      Specified by:
      equals in interface Function<String,T extends Enum<T>>
      Overrides:
      equals in class Converter<String,T extends Enum<T>>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object