Class Converter.IdentityConverter<T>

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

    private static final class Converter.IdentityConverter<T>
    extends Converter<T,​T>
    implements java.io.Serializable
    A converter that always converts or reverses an object to itself. Note that T is now a "pass-through type".
    • Constructor Detail

      • IdentityConverter

        private IdentityConverter()
    • Method Detail

      • doForward

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

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

        public Converter.IdentityConverter<T> 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.

        Overrides:
        reverse in class Converter<T,​T>
      • doAndThen

        <S> Converter<T,​S> doAndThen​(Converter<T,​S> otherConverter)
        Description copied from class: Converter
        Package-private non-final implementation of andThen() so only we can override it.
        Overrides:
        doAndThen in class Converter<T,​T>
      • toString

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

        private java.lang.Object readResolve()