Class Converter.ReverseConverter<A,​B>

  • All Implemented Interfaces:
    Function<B,​A>, java.io.Serializable, java.util.function.Function<B,​A>
    Enclosing class:
    Converter<A,​B>

    private static final class Converter.ReverseConverter<A,​B>
    extends Converter<B,​A>
    implements java.io.Serializable
    • Constructor Detail

      • ReverseConverter

        ReverseConverter​(Converter<A,​B> original)
    • Method Detail

      • doForward

        protected A doForward​(B b)
        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<B,​A>
        Parameters:
        b - the instance to convert; will never be null
        Returns:
        the converted instance; must not be null
      • doBackward

        protected B doBackward​(A a)
        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<B,​A>
        Parameters:
        a - the instance to convert; will never be null
        Returns:
        the converted instance; must not be null
      • reverse

        public Converter<A,​B> reverse()
        Description copied from class: Converter
        Returns the reversed view of this converter, which converts this.convert(a) back to a value roughly equivalent to a.

        The returned converter is serializable if this converter is.

        Note: you should not override this method. It is non-final for legacy reasons.

        Overrides:
        reverse in class Converter<B,​A>
      • 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<A,​B>
        Overrides:
        equals in class Converter<B,​A>
      • hashCode

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

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