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

  • All Implemented Interfaces:
    Function<java.lang.String,​T>, java.io.Serializable, java.util.function.Function<java.lang.String,​T>
    Enclosing class:
    Enums

    private static final class Enums.StringConverter<T extends java.lang.Enum<T>>
    extends Converter<java.lang.String,​T>
    implements java.io.Serializable
    • Field Detail

      • enumClass

        private final java.lang.Class<T extends java.lang.Enum<T>> enumClass
    • Constructor Detail

      • StringConverter

        StringConverter​(java.lang.Class<T> enumClass)
    • Method Detail

      • doForward

        protected T doForward​(java.lang.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<java.lang.String,​T extends java.lang.Enum<T>>
        Parameters:
        value - the instance to convert; will never be null
        Returns:
        the converted instance; must not be null
      • doBackward

        protected java.lang.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<java.lang.String,​T extends java.lang.Enum<T>>
        Parameters:
        enumValue - the instance to convert; will never be null
        Returns:
        the converted instance; must not be null
      • equals

        public boolean equals​(java.lang.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<java.lang.String,​T extends java.lang.Enum<T>>
        Overrides:
        equals in class Converter<java.lang.String,​T extends java.lang.Enum<T>>
      • hashCode

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object